Question: Let's write a function to collect a grocery list from a user. This function should return a list of strings: def collect _ grocery _
Let's write a function to collect a grocery list from a user. This function should return a list of strings:
def collectgrocerylist Liststr:
pass
When the function is called, the user is repeatedly asked for a grocery list item until they type "STOP":
printcollectgrocerylist
Please enter a grocery item or STOP: milk
Please enter a grocery item or STOP: tea
Please enter a grocery item or STOP: bread
Please enter a grocery item or STOP: peanut butter
Please enter a grocery item or STOP: STOP
milk 'tea', 'bread', 'peanut butter'Lets write a function to collect a grocery list from a user. This function should return a list of strings:
def collectgrocerylist Liststr:
pass
When the function is called, the user is repeatedly asked for a grocery list item until they type "STOP":
printcollectgrocerylist
Please enter a grocery item or STOP: milk
Please enter a grocery item or STOP: tea
Please enter a grocery item or STOP: bread
Please enter a grocery item or STOP: peanut butter
Please enter a grocery item or STOP: STOP
milk 'tea', 'bread', 'peanut butter'
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
