题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
inp0 = input().strip()
result_str = ''
for char in inp0:
if char.islower():
if char in 'abc':
result_str +='2'
elif char in 'def':
result_str +='3'
elif char in 'ghi':
result_str +='4'
elif char in 'jkl':
result_str +='5'
elif char in 'mno':
result_str +='6'
elif char in 'pqrs':
result_str +='7'
elif char in 'tuv':
result_str +='8'
else:
result_str +='9'
elif char.isupper():
new = chr((ord(char.lower())-ord('a') + 1 ) % 26 + ord('a'))
#print(new)
result_str += new
else:
result_str +=char
print(result_str)
用了一个繁琐的方法但是排除了单独判断Z的情况
#23届找工作求助阵地#

