Python program to Reverse Numbers

x = int(input("Insert some numbers: "))
y = 0
z = x
while x != 0:
 digit = x%10
 x = x//10
 y = y*10
 y = y+digit
print("The reversed of ",z," = ",y)

 

 

Output:

Insert some numbers: 1283
The reversed of  1283  =  3821

 

Insert some numbers: 1991
The reversed of  1991  =  1991

Subscribe For Daily Updates