蟒蛇挑战1
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了蟒蛇挑战1相关的知识,希望对你有一定的参考价值。
#1 import string frm = "abcdefghijklmnopqrstuvwxyz" to = "cdefghijklmnopqrstuvwxyzab" data = """g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylbgq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.""" print string.translate(data, string.maketrans(frm,to)) #2 import string frm = "abcdefghijklmnopqrstuvwxyz" to = "cdefghijklmnopqrstuvwxyzab" data = """g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylbgq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.""" result = '' for c in data: if c in frm: result += to[frm.index(c)] else: result += c print result #3 import string s = " " for c in t : if c in string.letters : s += chr((ord(c) + 2 - 97) % 26 + 97) else : s += c print s </code>
以上是关于蟒蛇挑战1的主要内容,如果未能解决你的问题,请参考以下文章