Check the number is palindrome or not Python Program - CodexRitik

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:
Input = 121
If Output =121 After Flipping the number then Number is palindrome
Otherwise Number is not palindrome.

  • Click For Image view
 
Check the number is palindrome or not Python Program - CodexRitik Check the number is palindrome or not Python Program - CodexRitik Reviewed by CodexRitik on July 01, 2020 Rating: 5

No comments:

Powered by Blogger.