在加密时,如何修改使其在到达“z”后返回“a”?在
# ceaser cipher encoder
# by SaLiXa MoUdInHo aka Okhotnik
def ccipher():
print "This is a program to compute the ceaser cipher encoding algorithm"
# get the input from the user
text = raw_input("Enter the text you want to encode: ")
jmp = input("Input the numerical value of the key: ")
# set up an accumulator
lstmsg = ""
for j in text:
lstmsg = lstmsg + chr(ord(j) +jmp)
# output the encrypted message
print "[" + lstmsg + "]"
Python源代码:
测试用例:
^{pr2}$输出:
相关问题 更多 >
编程相关推荐