Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please solve the following problem in python. Please write a function named all_the_longest, which takes a list of strings as its argument. The function should
Please solve the following problem in python.
Please write a function named all_the_longest, which takes a list of strings as its argument. The function should return a new list containing the longest string in the original list. If more than one are equally long, the function should return all of the longest strings. The order of the strings in the returned list should be the same as in the original. my_list = ["first", "second", "fourth", "eleventh"] result = all_the_longest ( my_list) print ( result) # ['eleventh'] my_list = ["adele", "mark", "dorothy", "tim", "hedy", "richard"] result = all_the_longest(my_list) print(result) \# ['dorothy', 'richard']
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started