Here is an example that takes a user's input and checks if the input is a palindrome:
name = input("Write your word here: ")
input("Press to check if the word is a palindrome.")
if str(name) == str(name)[::-1]:
print("True")
else:
print("False")
However, there is no need to even set up the if
/else
statement. You can directly print the result of the logical comparison, as shown here:
name = input("Write your word here: ")
input("Press to check if the word is a palindrome.")
print(str(name) == str(name)[::-1])