python 练习题89整理

# -*- coding: utf-8 -*-
"""
Created on Mon Jun 17 14:30:12 2019

@author: txx
"""

"""m=6489
a=(int(m%10)+5)%10
b=(int(m/10)%10+5)%10
c=(int(m/100)%10+5)%10
d=(int(m/1000)+5)%10

n=a*1000+c*10+b*100+d
print(n)"""


from sys import stdout
if __name__=='__main__':   #https://blog.csdn.net/anshuai_aw1/article/details/82344884
    a=int(input('请输入四个数字\n'))
    aa=[]
    aa.append(int(a%10))
    aa.append(int(a%100/10))
    aa.append(int(a%1000/100))
    aa.append(int(a/1000))
    
    for i in range(4):
        aa[i]+=5
        aa[i]%=10
    for i in range(2):
        aa[i],aa[3-i]=aa[3-i],aa[i]
    for i in range(3,-1,-1):
        stdout.write(str(aa[i]))  # sys.stdout就是print的一种默认输出格式,等于print" "


        



 

你可能感兴趣的:(python)