Python - WAP to Reverse any given Number in Python - 09
This is a Python Code to Reverse any given Number using Python 3.5
Source Code:#!/usr/bin/python3 while True: num = int(input("Enter a Number to be Reversed : ")) rev = 0 # Loop till the Number is reversed. while ( num > 0 ): mod = num % 10 rev = rev * 10 + mod num = num // 10 # Printing the Reversed Number. print ("The Reversed Number is : ", rev) # Continue Block. if (input("To Continue ['y'/'n'] : ") == 'y'): continue else: break
Program Output:
...
Post a Comment