其他分享
首页 > 其他分享> > 凯撒加密

凯撒加密

作者:互联网

n = int(input())
new_sentence = ""
for c in sentence:
if c>="a" and c<="z":
new_sentence+= chr( ord('a') + ((ord(c)-ord('a')) + n )%26 )
elif c>="A" and c<="Z":
new_sentence+= chr( ord('A') + ((ord(c)-ord('A')) + n )%26 )
else:
new_sentence += c
print(new_sentence)

 

标签:26,加密,sentence,int,chr,new,ord,凯撒
来源: https://www.cnblogs.com/lzw2019114243036/p/15339696.html