题解 | #密码游戏#
密码游戏
https://www.nowcoder.com/practice/36641ab168664384aff798ba7ce34bc1
a1 = input() re = [] for i in a1: # 字符串可以遍历 x = (int(i) + 3) % 9 re.append(str(x)) # 如果是数字数组,join函数报错,所以这里需要加上str() re[0],re[2] = re[2],re[0] re[1],re[3] = re[3],re[1] print(''.join(re))