Check The Number is Palindrome Or Not In python
In This program You Can Check the Number is Palindrome or Not Using String Method:
Code:
number=int(input('enter the number you want to check:'))
temp=number
c=0;b=''
for i in range(len(str(number))):
c=number%10
b=b+str(c)
number=number//10
d=int(b)
if(d==temp):
print('number is palindrome')
else:
print('number is not palindrome')
- Explanation:
If Output =121 After Flipping the number then Number is palindrome
Otherwise Number is not palindrome.
Check the number is palindrome or not Python Program - CodexRitik
Reviewed by CodexRitik
on
July 01, 2020
Rating:
No comments: