题解 | #密码游戏#
密码游戏
https://www.nowcoder.com/practice/36641ab168664384aff798ba7ce34bc1
ans = [] s = input() for i in range(len(s)): ans.append((int(s[i])+3)%9) ans[0],ans[2]=ans[2],ans[0] ans[1],ans[3]=ans[3],ans[1] for i in range(len(ans)): print(ans[i],end="")
ans定义成str类型,在交换的时候会报错