Python Palindrome Program using Functions


Topic: Python Palindrome Program using Functions

Solution

 
reverse = 0
def integer_reverse(number):
    global reverse
    
    if(number > 0):
        Reminder = number % 10
        reverse = (reverse * 10) + Reminder
        integer_reverse(number // 10)
    return reverse
number = int(input("Please Enter any Number: "))
rev = integer_reverse(number)
print("Reverse of a Given number is = %d" %rev)
if(number == rev):
    print("%d is a Palindrome Number" %number)
else:
    print("%d is not a Palindrome Number" %number)



List all Python Programs