字符串加密

243 阅读1分钟

描述:用户在一行中输入一个包括大小写字母和数字的[字符串],编程将其中的大写字母用该字母后的第4个字母替代,其他字符原样输出,实现字符串加密。

```​
a = input("")
for i in a:
    if ord('A')<=ord(i)<=ord('Z'):
        print(chr(ord('A')+(ord(i)-ord('A')+4)%26),end="")
    else:
        print(i,end="")
 
​