题解 | #简单密码#python3
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
fake = input()
true = list(fake)
for i in range(len(fake)):
if 'a'<= fake[i] <='z':
if fake[i] in 'abc':
true[i] = '2'
if fake[i] in 'def':
true[i] = '3'
if fake[i] in 'ghi':
true[i] = '4'
if fake[i] in 'jkl':
true[i] = '5'
if fake[i] in 'mno':
true[i] = '6'
if fake[i] in 'pqrs':
true[i] = '7'
if fake[i] in 'tuv':
true[i] = '8'
if fake[i] in 'wxyz':
true[i] = '9'
elif 'A'<= fake[i] <='Z':
if fake[i] == 'Z':
true[i] = 'a'
else:
true[i] = chr(ord(fake[i])+32+1)
else:
continue
print(''.join(true))