Write a program to check whether a number is palindrome or not in python
Answers
Answered by
0
Answer:
Python program to check whether a number is a palindrome or not.
Explanation:
# Program to check if a string
# is palindrome or not
# change this value for a different output
my_str = 'RAMAN'
# make it suitable for caseless comparison
my_str = my_str.casefold()
# reverse the string
rev_str = reversed(my_str)
# check if the string is equal to its reverse
if list(my_str) == list(rev_str):
print("It is a palindrome")
else:
print("It is not a palindrome")
Output:
It is not a palindrome.
Similar questions