Question: Using list comprehension, define a function on a single line named create_list_of_palindromes (words_list) that takes a list of words and returns a list of tuples


Using list comprehension, define a function on a single line named create_list_of_palindromes (words_list) that takes a list of words and returns a list of tuples containing the word and the string length for each word where the word is a palindrome. A palindrome is a word that reads the same backwards as forwards, e.g. madam. NOTE: You must use list comprehension to solve this exercise. For example: Test print(create_list_of_palindromes(['hello', 'civic', 'good', 'job', 'hannah', 'done', 'nun print(create_list_of_palindromes(['racecar', 'level', 'test', 'case'])) print(create_list_of_palindromes([] )) Result nun]))[(civic,5),(hannah,6),(nun,3)][(racecar,7),(level,5)] []
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
