Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

palindrome of a number in python

# Python3 code to demonstrate
# checking a number is palindrome
# using str() + string slicing
  
# initializing number 
test_number = 9669669
  
# printing the original number 
print ("The original number is : " + str(test_number))
  
# using str() + string slicing
# for checking a number is palindrome
res = str(test_number) == str(test_number)[::-1]
  
# printing result
print ("Is the number palindrome ? : " + str(res))
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #palindrome #number #python
ADD COMMENT
Topic
Name
5+9 =