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
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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3b25bdcc-1f5e-4716-88d3-d1e15ee2df25%2Fb25a78bf-7190-46f6-9d92-cc50c45bb721%2F184q2f_processed.png&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
