使用关键字阻止加密

时间:2015-03-28 11:56:18

标签: python-3.x

我正在使用Python3.4.1。任何帮助将不胜感激

text = (str(input('Enter your message here, in upper case')))
key = (str(input('Enter the key word here, in upper case')))
for a in range (0,len(text),1):
    code = ord((text[a])+(ord(key[a%len(key)]))-64)
    if (text[a]==' '):
        print(' ', end= '')
    elif code > 90:
        print(chr(code + 26), end = '')
    else:
        print(chr(code), end = '')

0 个答案:

没有答案