To check whether the given number is a palindrome number or not a palindrome number in python, you have to ask from user to enter a number to check for palindrome number as shown in the program given here.
Following python program ask from user to check whether it is a palindrome number or not:
# Python Program - Check Palindrome Number or Not while True: print("Enter 'x' for exit.") num = input("Enter any number: ") if num == 'x': break else: number = int(num) orig = number rev = 0 while number > 0: rev = (rev*10) + number%10 number //= 10 if orig == rev: print(orig, "is a Palindrome Number.\n") else: print(orig, "is not a Palindrome Number.\n")
Here is the sample run of the above Python program to illustrate how to check for palindrome number:
You may also like to learn or practice the same program in other popular programming languages: