题解 | 密码游戏
密码游戏
https://www.nowcoder.com/practice/36641ab168664384aff798ba7ce34bc1
code = int(input())
lists = []
for i in range(4):
no = 1000 / 10 ** i
num = int(code // no)
code = code % no
lists.append(num)
new_list = []
for n in range(4):
temp = int((lists[n] + 3) % 9)
new_list.append(temp)
def swap(list, i, j):
tmp = list[i]
list[i] = list[j]
list[j] = tmp
swap(new_list, 0, 2)
swap(new_list, 1, 3)
for n in range(4):
print(new_list[n], end="")

