Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to print palindrome number from 1 to n in python

n = int(input())
if n < 100:
    for i in range(1, n+1):
        strI = str(i)
        lStrI = list(strI)
        rList = list(reversed(lStrI))
        if lStrI == rList:
            print(i)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #print #palindrome #number #python
ADD COMMENT
Topic
Name
9+4 =