Python program to check whether a number is Palindrome or not
def is_palindrome(number):
# Convert the number to a string for easy comparison of characters
num_str = str(number)
# Reverse the string
reversed_str = num_str[::-1]
# Check if the original string is equal to its reverse
if num_str == reversed_str:
return True
else:
return False
# Input: take a number from the user
num = int(input("Enter a number: "))
# Check if the number is a palindrome and print the result
if is_palindrome(num):
print(f"{num} is a palindrome.")
else:
print(f"{num} is not a palindrome.")