题解 | #密码游戏#
密码游戏
https://www.nowcoder.com/practice/36641ab168664384aff798ba7ce34bc1
try: num = int(input('')) except Exception: print('输入的数字不正确') else: numstr = str(num) numlist = [] for i in numstr: tmp = str((int(i)+3)%9) numlist.append(tmp) for i in range(2): tmp = numlist[i] numlist[i] = numlist[i+2] numlist[i+2] = tmp lastnum =''.join(numlist) print(lastnum)