我不知道为什么它不起作用。
这是我的问题
谢谢。
加密的消息='I wtvp olel decfnefcpd lyo lwrzctesxd'
cipher ='lmnopqrstuvwxyzabcdefghijk'
键= 11 ##
cipher_text = input('输入已加密的消息:')
clean_text =''
for i for cipher_text:
if i != " ":
clean_text = clean_text + chr((ord(i)-key))
else:
clean_text = clean_text + ' '
print(clean_text)结果:
输入加密的消息:I wtvp olel decfnefcpd lyo lwrzctesxd像daZa YZX [cZ [XeY和algoXiZhmY] >>伙计们,我的代码确实需要帮助。我不知道为什么它不起作用。这是我在代码中的问题,这很简单,那么答案是错误的。在加密的文本中,它的首字母为'I',...
plain = 'abcdefghijklmnopqrstuvwxyz'
cipher = 'lmnopqrstuvwxyzabcdefghijk'
key = 11
cipher_text = input('Enter enciphered message: ')
clean_text = ' '
for i in cipher_text:
if i != " ":
if(i.isupper()):
clean_text = clean_text + chr((ord(i) - key-65) % 26 + 65)
else:
clean_text = clean_text + chr((ord(i) - key - 97) % 26 + 97)
else:
clean_text = clean_text + ' '
print(clean_text)