## Function practice 1

Points: 2
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Python3

This practice problem will require you to programme basic functions.

Your task is to determine whether an integer is a palindrome. A palindrome is an integer that reads the same backward as forward, the following are some example palindromes:

1
121
5665
22

#### Input Specification

The first line will contain a single integer $$N$$ ($$1 < N < 10000$$), indicating the number of test cases.

The following $$N$$ lines will each contain a single integer $$P$$ ($$1 < P < 100000000$$), for which you need to determine if it's a palindrome.

#### Output Specification

The output should contain $$N$$ lines, each line a true or false, indicating whether the $$i$$th input is a palindrome.

#### Sample Input

5
13
121
98780
5665
22

#### Sample Output

false
true
false
true
true

## Comments

• Mais  commented on March 23, 2021, 9:12 a.m.

### Asking the user to input N value

n = int(input())

number =[]

### Taking inputs into list

for i in range(n): number.append(int(input()))

### Checking each number is palindrome or not

for i in number:

#converting the number to string
numstr = str(i)
#reversing the number and storing in revnum
revnum = numstr[::-1]
#checking palindrome condition
if(revnum == numstr):
#if yes prints True
print(True)
#if no prints false
else:
print(False)