已有一个字符串s=Today is Monday. l am on holiday. How nice!‘加密算法为将大写字母后移动一位输出,将小写字母前移动一位输出。其它字不变

s='Today is Monday. I am on holiday. How nice!'  
password=''
for ch in s:
    if ch>='A' and ch<'Z':
        password=password+chr(ord(ch)+1)
    elif ch=='Z':
       password=password+'A'
    elif ch>'a'and ch<='z':
        password=password+chr(ord(ch)-1)
    elif ch=='a':
        password=password+'z'
    else:
        password=password+ch
print(password)
上一篇:redis持久化


下一篇:How do I do 'dir /s /b' in PowerShell?