Python Program to print Palindrome numbers from 1 to 100

Write a Python Program to print Palindrome numbers from 1 to 100 or 1 to n or minimum to maximum with an example.

Python Program to print Palindrome numbers using While Loop

This python program allows the user to enter the maximum limit value. Next, this program prints palindrome numbers from 1 to user-entered value. First, we used For Loop to iterate a loop between 1 and maximum value. within the for loop,

  • We used While Loop to reverse the given number.
  • The if statement checks whether the given number is Palindrome Number or Not, for this, it compares the original value with the reverse number.

TIP: I suggest you to refer reverse a Number, and Palindrome Program article to understand this python program logic.

# Python Program to print Palindrome numbers from 1 to 100
 
maximum = int(input(" Please Enter the Maximum Value : "))

print("Palindrome Numbers between 1 and %d are : " %(maximum))
for num in range(1, maximum + 1):
    temp = num
    reverse = 0
    
    while(temp > 0):
        Reminder = temp % 10
        reverse = (reverse * 10) + Reminder
        temp = temp //10

    if(num == reverse):
        print("%d " %num, end = '  ')

Python Palindrome numbers from 1 to 1000 output

 Please Enter the Maximum Value : 1000
Palindrome Numbers between 1 and 1000 are : 
1   2   3   4   5   6   7   8   9   11   22   33   44   55   66   77   88   99   101   111   121   131   141   151   161   171   181   191   202   212   222   232   242   252   262   272   282   292   303   313   323   333   343   353   363   373   383   393   404   414   424   434   444   454   464   474   484   494   505   515   525   535   545   555   565   575   585   595   606   616   626   636   646   656   666   676   686   696   707   717   727   737   747   757   767   777   787   797   808   818   828   838   848   858   868   878   888   898   909   919   929   939   949   959   969   979   989   999  

Python Program to display Palindrome numbers using Functions

In this Python program, we allow users to enter the minimum and maximum values. Next, it prints palindrome numbers between the minimum and maximum values.

# Python Program to print Palindrome numbers from 1 to 100
 
minimum = int(input(" Please Enter the Minimum Value : "))
maximum = int(input(" Please Enter the Maximum Value : "))

print("Palindrome Numbers between %d and %d are : " %(minimum, maximum))
for num in range(minimum, maximum + 1):
    temp = num
    reverse = 0
    
    while(temp > 0):
        Reminder = temp % 10
        reverse = (reverse * 10) + Reminder
        temp = temp //10

    if(num == reverse):
        print("%d " %num, end = '  ')
Python Program to print Palindrome numbers from 1 to 100 2