-1

I have trouble making this program because I don't know how to make it so the program will ignore capitalization. I used .lower but I think I'm inserting it wrong.

word=input("Give me a word to detect if it is a palindrome")
word=str(word)

if word.lower[::-1]=word :
    print("That's a palindrome")
else:
    print("Sorry this isn't a palindrome")
ma_tthews
  • 21
  • 3

1 Answers1

0

Try this:

word=input("Give me a word to detect if it is a palindrome: ")
word_list = word.split()
for i in word_list:
   if i.lower()[::-1]==i.lower() and len(i) > 1:
      print("That's a palindrome")
   else:
      print("Sorry this isn't a palindrome")

This will detect all palindromes and if you want only one word as input, remove the for loop.

Rahil Kadakia
  • 135
  • 1
  • 6