Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete the get_shortest_name function which is passed a list of strings as a p

ID: 3755095 • Letter: C

Question

Complete the get_shortest_name function which is passed a list of strings as a parameter. The function returns the word in the list which has the least characters (i.e., the shortest name). If two or more words in the list have the same number of characters as the shortest name, the function should return the first name from the start of the list which has the least characters. If the parameter list is empty, the function should return an empty string For example Test Result print("1.", get_shortest name(["Candide", "Jessie", "Kath", "Amity", "Raeanne"])) 1. Kath Answer (penalty regime: 0 %) 1 -ldef get shortest name (words)

Explanation / Answer

def get_shortest_name(words): if len(words) == 0: return "" else: shortest = words[0] for word in words: if len(word)
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote