c05ex07.py

2018-03-30  本文已影响0人  特丽斯纳普
# c05ex07.py
#    Caesar cipher (non-circular)

def main():
    print("Caesar cipher")
    print()

    key = int(input("Enter the key value: "))
    plain = input("Enter the phrase to encode: ")
    cipher = ""
    for letter in plain:
        cipher = cipher + chr(ord(letter) + key)

    print("Encoded message follows:")
    print(cipher)

main()
上一篇 下一篇

猜你喜欢

热点阅读