python实现 古典密码 凯撒密码的加密与解密
实现效果如下图:
# 凯撒密码加密与解密
# author Sundm
string = [a,,c,d,e,f,g,h,i,j,k,l,m, ,o,p,q, ,s, ,u,v,w,x,y,z]
# 密文列表
cipher_text_list = []
# 明文列表
plain_text_list = []
# 凯撒密码加密函数
def encrypt():
cipher = int(input("请输入你的密钥:"))
plaintext = input("请输入你的明文:")
length = len(plaintext)
print("加密后的密文是:")
for i in range(0,length):
cipher_text_list.append(string[string.index(plaintext[i])+cipher])
print(cipher_text_list[i],end=&#