Skip to content

Commit b831a42

Browse files
author
Amogh Singhal
authored
Create is_num_palindrome.py
1 parent b1d2d01 commit b831a42

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

is_num_palindrome.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Write a program to check if a
2+
# number is a palindrome or not
3+
4+
def is_num_palindrome(num):
5+
temp = str(num)
6+
i = 0
7+
j = len(temp) - 1
8+
9+
while j > i:
10+
print(temp[i], temp[j])
11+
if temp[i] == temp[j]:
12+
i = i + 1
13+
j = j - 1
14+
else:
15+
return False
16+
return True
17+
18+
n = 3456543
19+
res = is_num_palindrome(n)
20+
print(res)

0 commit comments

Comments
 (0)