题解 | #简单密码#
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
while True:
try:
password = input()
ls1 = []
for item in password:
if ord(item) >= 65 and ord(item) <= 90:
item = item.lower()
if item != 'z':
item = chr(ord(item)+1)
else:
item = 'a'
ls1.append(item)
elif ord(item) >= 97 and ord(item) <= 122:
if ord(item) >= 97 and ord(item) <= 99:
ls1.append('2')
elif ord(item) >= 100 and ord(item) <= 102:
ls1.append('3')
elif ord(item) >= 103 and ord(item) <= 105:
ls1.append('4')
elif ord(item) >= 106 and ord(item) <= 108:
ls1.append('5')
elif ord(item) >= 109 and ord(item) <= 111:
ls1.append('6')
elif ord(item) >= 112 and ord(item) <= 115:
ls1.append('7')
elif ord(item) >= 116 and ord(item) <= 118:
ls1.append('8')
elif ord(item) >= 119 and ord(item) <= 122:
ls1.append('9')
else:
ls1.append(item)
print(''.join(ls1))
except:
break