Question: [H9-1] (string_1ist.py) Complete the starting code for a function build_1ist () which repeatedly prompts the user to enter a string, adding each to a new
[H9-1] (string_1ist.py) Complete the starting code for a function build_1ist () which repeatedly prompts the user to enter a string, adding each to a new list a_list via append (). Do this by using the accumulator pattern: initialize a_list to the empty list [1, then iterate over each imput string. appending each (a_list.append (...)) to the end of a_list. The empty string should be your sentinel, ending your input loop. Retum a_list as the result of your function call. \#\# copy your build_list() function from hg-1 here Gdef count_words(a_List,a_Length): to_return =[] \# return list of all words in a_list with Length == a_Length return to_return \# finish this def main(): pass \# complete this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
