题解 | #密码游戏#

密码游戏

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)

全部评论

相关推荐

点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务