Python Program to Check Palindrome

« Previous Program Next Program »

Check Palindrome in Python

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.

Python Programming Code to Check Palindrome

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':
		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")
			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:

python check palindrome number

Same Program in Other Languages

You may also like to learn or practice the same program in other popular programming languages:

« Previous Program Next Program »


Quick Links
Signup - Login - Give Online Test