数据加密 整数向后移n个位置

img


a=int(input())
b=int()
c=''
后面怎么写 用for in
while
if之类的

a=int(input())
b=input()
c=""
for x in b:  
    if 'a' <= x <= 'z':  
        c += chr((ord(x) - ord('a') + a) % 26 + ord('a'))
    elif 'A' <= x <= 'Z':  
        c += chr((ord(x) - ord('A') + a) % 26 + ord('A')) 
    else:  
        c += x  
print(c)  

img