Question :
write a function reverse_number () to return the reverse of the number entered.
Example :
Reverse_number(1234) display 4321
Source code :
def reverse_number (num):
add=""
while (num > 0):
n=num%10 # logic
num=num//10
add=str(add)+str(n)
print(add)
num = int (input("Enter the number : "))
reverse_number(num)
No comments:
Post a Comment