简单密码#ascii码ord() chr()
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
''' print(ord('a'),ord('b'),ord('A'),ord('B')) print(chr(97),chr(98),chr(65),chr(66)) print('A'.lower()) mapping={0:0,1:1,'abc':2,'def':3,'ghi':4,'jkl':5,'mno':6,'pqrs':7,'tuv':8,'wxyz':9} print(mapping.items()) print(mapping.keys(),mapping.values()) print('s' in list(mapping.keys())[9]) ''' pw=str(input()) #mapping={0:0,1:1,2:'abc',3:'def',4:'ghi',5:'jkl',6:'mno',7:'pqrs',8:'tuv',9:'wxyz'} #print(mapping.keys,mapping.values) mapping=['0','1','abc','def','ghi','jkl','mno','pqrs','tuv','wxyz'] # new_pw='' for i in pw: if 65<=ord(i)<=89: new_pw += chr(ord(i.lower())+1) elif ord(i)==90: new_pw += 'a' elif 97<=ord(i)<=122: for j in mapping: if i in j: new_pw += str(mapping.index(j)) else: new_pw += i print(new_pw)