The Python Challenge Level 1

图片提示 K->M  O->Q  E->G ,每个字母后移了2位 
使用string和maketrans可以解决此问题 
代码如下:

#! /bin/usr/python



import string

original  = "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."



rules = string.maketrans("abcdefghijklmnopqrstuvwxyz", "cdefghijklmnopqrstuvwxyzab")



print original.translate(rules)

print "map".translate(rules)

  

你可能感兴趣的:(python)