palindromes Write a function palindromes that accepts a sentence as an argument. The function then returns a list of all words in the sentence that are palindromes, that is they are the same forwards and backwards. Guidelines: • punctuation characters .,;!? should be ignored • the palindrome check should not depend on case Sample usage: >>> palindromes ("Hey Anna, would you prefer to ride in a kayak or a racecar?") ['Anna', 'a', 'kayak', 'a', 'racecar'] >>> palindromes ("Able was I ere I saw Elba.") ['I', 'ere', 'I'] >>> palindromes ("Otto, go see Tacocat at the Civic Center, their guitar solos are Wow!") ['Otto', 'Tacocat', 'Civic', 'solos', 'wow'] >>> palindromes ("Otto, go see Tacocat at the Civic Center, their guitar solos are wow!")==['Otto', 'Tacocat', 'Civic', 'solos', 'wow'] True

icon
Related questions
Question
palindromes
Write a function palindromes that accepts a sentence as an argument. The function then
returns a list of all words in the sentence that are palindromes, that is they are the same forwards
and backwards. Guidelines:
• punctuation characters .,;!? should be ignored
•
the palindrome check should not depend on case
Sample usage:
>>> palindromes ("Hey Anna, would you prefer to ride in a kayak or a racecar?")
['Anna', 'a', 'kayak', 'a', 'racecar']
>>> palindromes ("Able was I ere I saw Elba.")
['I', 'ere', 'I']
>>> palindromes ("Otto, go see Tacocat at the Civic Center, their guitar solos are
Wow!")
['Otto', 'Tacocat', 'Civic', 'solos', 'wow']
>>> palindromes ("Otto, go see Tacocat at the Civic Center, their guitar solos are
wow!")==['Otto', 'Tacocat', 'Civic', 'solos', 'wow']
True
Transcribed Image Text:palindromes Write a function palindromes that accepts a sentence as an argument. The function then returns a list of all words in the sentence that are palindromes, that is they are the same forwards and backwards. Guidelines: • punctuation characters .,;!? should be ignored • the palindrome check should not depend on case Sample usage: >>> palindromes ("Hey Anna, would you prefer to ride in a kayak or a racecar?") ['Anna', 'a', 'kayak', 'a', 'racecar'] >>> palindromes ("Able was I ere I saw Elba.") ['I', 'ere', 'I'] >>> palindromes ("Otto, go see Tacocat at the Civic Center, their guitar solos are Wow!") ['Otto', 'Tacocat', 'Civic', 'solos', 'wow'] >>> palindromes ("Otto, go see Tacocat at the Civic Center, their guitar solos are wow!")==['Otto', 'Tacocat', 'Civic', 'solos', 'wow'] True
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer