题解 | #字符串加解密#
字符串加解密
https://www.nowcoder.com/practice/2aa32b378a024755a3f251e75cbf233a
def encrypt(code,mode): res = '' for i in code: if 48 <= ord(i) <= 57: res += chr(48 + (ord(i) - 48 - mode) % 10) elif 65 <= ord(i) <= 90: res += chr(97 + (ord(i) - 65 - mode) % 26) elif 97 <= ord(i) <= 122: res += chr(65 + (ord(i) - 97 - mode) % 26) return res while True: try: str1 = input() str2 = input() print(encrypt(str1,-1)) print(encrypt(str2,1)) except: break