Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

palindrome of a number in python

num=int(input("Enter a no.:"))
rev=0
num1=num
while num!=0:
    rev=rev*10+(num%10)
    num=num//10
if num1==rev:
    print(num1," is a palindrome")
else:
    print(num1," is not a palindrome") 
Source by www.kdnuggets.com #
 
PREVIOUS NEXT
Tagged: #palindrome #number #python
ADD COMMENT
Topic
Name
1+5 =