解码给定的加密文本,结果不是我想要的[关闭]

问题描述 投票:-3回答:1
伙计们,我的代码确实需要帮助。.

我不知道为什么它不起作用。

这是我的问题

    在我的代码中,这很简单,然后答案是错误的。
  1. 在加密的文本中,它的首字母为'I',结果它不见了,我应该怎么做?
  2. 结果与我的想法完全不同
  • [请帮助我解决它。我在这里查看了很多有关密码的问题,但是由于我是Python的新手,所以很难理解。

    谢谢。

    加密的消息='I wtvp olel decfnefcpd lyo lwrzctesxd'

    plain ='abcdefghijklmnopqrstuvwxyz'

    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',...

  • python python-3.x encryption decode caesar-cipher
    1个回答
    0
    投票
    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)
    © www.soinside.com 2019 - 2024. All rights reserved.