# Function to check if a string is palindrome
def is_palindrome(s):
# Remove spaces and convert to lowercase for uniformity
s = s.replace(” “, “”).lower()
# Compare string with its reverse
return s == s[::-1]
# Test the function
word = “Madam”
if is_palindrome(word):
print(f’”{word}” is a palindrome ‘)
else:
print(f’”{word}” is not a palindrome ‘)

Leave a Reply
You must be logged in to post a comment.