word = input("Enter a word:")
a = word[::-1]
print (a)
if a == word:
print ("The entered word is a palindrome.")
if a != word:
print ("The entered word is not a palindrome.")
This is my current code to see if a word is a palindrome or not. A palindrome is a word that is written the same backwards/forwards. e.g mum and dad, hannah etc.
How would I change this so that I can use it for a phrase also? e.g a phrase could be : "Lisa Bonet ate no basil"
However, with the code I have it wouldn't recognise the sentence as a palindrome. What do I need to do to fix that?