题解 | #简单密码#
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
python3小白解法
testchar = input() res = "" for i in range (len(testchar)): if ord(testchar[i]) >= 65 and ord(testchar[i]) < 90: tem = chr(ord(testchar[i].lower()) + 1) elif ord(testchar[i]) ==90: tem = 'a' elif ord(testchar[i]) >= 97 and ord(testchar[i]) <=99: tem = '2' elif ord(testchar[i]) >= 100 and ord(testchar[i]) <=102: tem = '3' elif ord(testchar[i]) >= 103 and ord(testchar[i]) <=105: tem = '4' elif ord(testchar[i]) >= 106 and ord(testchar[i]) <=108: tem = '5' elif ord(testchar[i]) >= 109 and ord(testchar[i]) <=111: tem = '6' elif ord(testchar[i]) >= 112 and ord(testchar[i]) <=115: tem = '7' elif ord(testchar[i]) >= 116 and ord(testchar[i]) <=118: tem = '8' elif ord(testchar[i]) >= 119 and ord(testchar[i]) <=122: tem = '9' else: tem = testchar[i] res = res + tem print(res)