Write a Python function to check if a string is a palindrome.
def is_palindrome(input_string):
input_string = input_string.lower().replace(" ", "")
reversed_string = input_string[::-1]
return input_string == reversed_string
# Test the function
my_string = "A man a plan a canal Panama"
is_palindrome = is_palindrome(my_string)
print(is_palindrome)
Comments
Post a Comment