Answered step by step
Verified Expert Solution
Question
1 Approved Answer
linux [132]$ python3 grocery,list.py What do you pick up in the store? (quit to exit) milk What do you pick up in the store? (quit
linux [132]\$ python3 grocery,list.py What do you pick up in the store? (quit to exit) milk What do you pick up in the store? (quit to exit) cake What do you pick up in the store? (quit to exit) pie What do you pick up in the store? (quit to exit) eggs What do you pick up in the store? (quit to exit) panko What do you pick up in the store? (quit to exit) quit You still need bread, butter You bought milk, cake, pie, eggs, panko linux[133]\$ python3 grocery list.py What do you pick up in the store? (quit to exit) quit You still need eggs, milk, bread, butter You bought linux[134]\$ python3 grocery,list.py What do you pick up in the store? (quit to exit) bread What do you pick up in the store? (quit to exit) milk What do you pick up in the store? (quit to exit) eggs What do you pick up in the store? (quit to exit) butter What do you pick up in the store? (quit to exit) tomato sauce What do you pick up in the store? (quit to exit) ramen What do you pick up in the store? (quit to exit) chicken What do you pick up in the store? (quit to exit) quit You have everything you need. You bought bread, milk, eggs, butter, tomato sauce, ramen, chicken Problem 2 - Grocery List For this problem you are going to go grocery shopping. You need eggs, bread, butter, and milk, of course. So, keep a list of all of the things that you pick up in the grocery store. At the end, you should print out what you bought and also print out if you bought all of the required items, or if you still need something. Call the file grocery_list.py. Forbidden Built-ins/Methods/etc This is not a complete listing, but it includes: - list slicing - Declaring your own Functions - Dictionaries creation using dict(), or \{\} , copying using dict (other_dict) .get(value, not_found_value) method accessing, inserting elements, removing elements. - break, continue - methods outside those permitted within allowed types for instance str.endswith list.index, list.count, etc. - Keywords you definitely don't need: await, as, assert, async, class, except, finally, global, lambda, nonlocal, raise, try, yield - The is keyword is forbidden, not because it's necessarily bad, but because it doesn't behave as you might expect (it's not the same as ==. - built in functions: any, all, breakpoint, callable, classmethod, compile, exec, delattr, divmod, enumerate, filter, map, max, min, isinstance, issubclass, iter, locals, oct, next, memoryview, property, repr, reversed, round, set, setattr, sorted, staticmethod, sum, super, type, vars, zip - If you have read this section, then you know the secret word is: argumentative. - exit() or quit() - If something is not on the allowed list, not on this list, then it is probably forbidden. - The forbidden list can always be overridden by a particular
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