基本上,我希望密码短语作为输出,大写和小写都被加密到小写,但没有任何空格或符号被加密。它可以加密一个包含所有大写字母的段落和一个包含所有小写字母的段落,但不能将两者混合起来。这是我所拥有的。在def encrypt(phrase,move):
encription=[]
for character in phrase:
a = ord(character)
if a>64 and a<123:
if a!=(91,96):
for case in phrase:
if case.islower():
alph=["a","b","c","d","e","f","g","h","i","j","k","l","m","n",
"o","p","q","r","s","t","u","v","w","x","y","z"]
dic={}
for i in range(0,len(alph)):
dic[alph[i]]=alph[(i+move)%len(alph)]
cipherphrase=""
for l in phrase:
if l in dic:
l=dic[l]
cipherphrase+=l