In this article, you will learn to write a Python Program Create Pandas Series and Display palindrome numbers. This article is very helpful for Python pandas beginners and CBSE Informatics practices class 12 students. So let’s start!

Before going ahead you should know how to create a series. I have already written one article on how to create pandas series. Follow the below-given link to understand the same:

Create Python Pandas Series

Python Program Create Pandas Series and Display palindrome numbers – Steps

Follow these steps to write a Python Program Create Pandas Series and Display palindrome numbers.

Python Program Create Pandas Series and Display palindrome numbers steps
  1. Import the pandas module using import pandas as pd
  2. Declare an empty list and n for the number of elements
  3. Take a for loop to ask the user to enter n number of elements and append values to the list
  4. Now create a series from the list created above
  5. Traverse the list using for loop
  6. Add logic to display palindrome numbers

Source Code Python Program Create Pandas Series and Display palindrome numbers

import pandas as pd
l=[]
n=int (input ("Enter no. of elements:"))
for i in range (n):
        v=int (input ('Enter number to add into list:'))
        l.append (v)
s=pd.Series(l)

for i in range (len(s)):
        t=s[i]
        r=0
        while s[i]>0:
                r=(r*10)+(s[i]%10)
                s[i]//=10
        if t==r:
                print(t)

Output – Python Program Create Pandas Series and Display palindrome numbers

Python Program Create Pandas Series and Display palindrome numbers - Comprehensive Guide for class 12 IP

Watch this video for more understanding:

Follow this link to get more questions on the series.

Series programs for class 12 informatics practices

That’s all from this article, thank you for visit!

Leave a Reply