题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
line = str(input())
###暴力解决
for item in line:
item = str(item)
if item in ('a','b','c'):
print(2,end='')
elif item in ('d','e','f'):
print(3,end='')
elif item in ('g','h','i'):
print(4,end='')
elif item in ('j','k','l'):
print(5,end='')
elif item in ('m','n','o'):
print(6,end='')
elif item in ('p','q','r','s'):
print(7,end='')
elif item in ('t','u','v'):
print(8,end='')
elif item in ('w','x','y','z'):
print(9,end='')
elif ord('A')<=ord(item)<=ord('Z') and item!='Z':
print(chr(ord(item.lower())+1),end='')
elif item=='Z':
print('a',end='')
else: print(item,end='')
查看8道真题和解析