Python Program to check a number is palindrome or not
In this program, You will learn how to check a number is palindrome or not in Python.
Some list are: 11 22 121 12321
Example: How to check a number is palindrome or not in Python.
n = int(input("Enter a number:"))
num = n
rev = 0
while n > 0:
r = n % 10
rev = rev * 10 + r
n = int(n / 10)
if rev == num:
print("Number is palindrome:", num)
else:
print("Number is not palindrome:", num)
Output:
Enter a number:121
Number is palindrome: 121