pythonchallenge1
dcy
posted @ 2009年9月29日 08:33
in Python Challenge
, 2570 阅读
everybody thinks twice before solving this.
|
#!/usr/bin/env python
import string
fr = "abcdefghijklmnopqrstuvwxyz"
to = "cdefghijklmnopqrstuvwxyzab"
s = '''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'''
print string.translate(s, string.maketrans(fr, to))
import string
fr = "abcdefghijklmnopqrstuvwxyz"
to = "cdefghijklmnopqrstuvwxyzab"
s = '''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'''
print string.translate(s, string.maketrans(fr, to))
maketrans(...)
maketrans(frm, to) -> string
Return a translation table (a string of 256 bytes long)
suitable for use in string.translate. The strings frm and to
must be of the same length.
2022年12月14日 21:01
The Python Challenge is a series of programming puzzles and challenges that are when international travel resume designed to teach and test the skills of Python programmers. The first challenge, Python Challenge 1, is a relatively simple challenge that involves solving a basic programming puzzle. You will get more details about it here.