Check If A Number Is A Palindrome In Python

Share on facebook
Share on twitter
Share on pinterest

In this Basic Python Program, we will have a look at how to “check if a number is a palindrome” with the help of Python Programming Language.

Python Program To Check If a Number is a Palindrome

n=int(input(“Enter number:”))

temp=n

rev=0

while(n>0):

    dig=n%10

    rev=rev*10+dig

    n=n//10

if(temp==rev):

    print(“The number is a palindrome!”)

else:

    print("The number isn't a palindrome!")

In the above program, we checked if a number is palindrome or not.

 

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *