Question: python Problem A: Grocery Bag (10 points): In this problem you will create a series of functions that will allow a user to add grocery

pythonpython Problem A: Grocery Bag (10 points): In this problem you willcreate a series of functions that will allow a user to addgrocery items to a bag, take items out of the bag, lookup

Problem A: Grocery Bag (10 points): In this problem you will create a series of functions that will allow a user to add grocery items to a bag, take items out of the bag, lookup items in the bag, and show the entire contents of the bag. For this problem, vou will use a dictionarv to store the users grocerv items. The functions you will need to write are below (explanations for each function are in the constraints): de f loo kup (d, Item) : def subitem (d,item) : def addItem (d,item): def show (d): This problem will also require you to create a main function that will allow users to specify the actions they would like to occur. To make this program look nicer we will be using the Unicode characters to represent each food item. We have provided a list of food items and Unicode values for them. To get the Unicode character to appear in the terminal, you will need to use the chr0 function with the decimal representation of the Unicode character as the input. For example running print (chr(127822) into a Python interpreter would show an apple (try it). We have provided a table with all of the items we will be using in testing your programs and the Unicode values associated with them. You MUST implement all of the food items in the table. [hint: use a dictionary] Here is a sample output of your program. Your program needs to resemble this program completely. In your dictionary, the key should holds the item name and respective value should holds the number counts of that item. If an item is added to the dictionary for the first time, the item name should be added as the key and the value should be 1. Then if the item is added again the value should be incremented by 1 each time. If an item not in the dictionary is called in the functions lookup, show, or subItem then nothing should happen! Remember you are only using the Unicode values in the lookup and show functions! Problem A: Grocery Bag (10 points): In this problem you will create a series of functions that will allow a user to add grocery items to a bag, take items out of the bag, lookup items in the bag, and show the entire contents of the bag. For this problem, vou will use a dictionarv to store the users grocerv items. The functions you will need to write are below (explanations for each function are in the constraints): de f loo kup (d, Item) : def subitem (d,item) : def addItem (d,item): def show (d): This problem will also require you to create a main function that will allow users to specify the actions they would like to occur. To make this program look nicer we will be using the Unicode characters to represent each food item. We have provided a list of food items and Unicode values for them. To get the Unicode character to appear in the terminal, you will need to use the chr0 function with the decimal representation of the Unicode character as the input. For example running print (chr(127822) into a Python interpreter would show an apple (try it). We have provided a table with all of the items we will be using in testing your programs and the Unicode values associated with them. You MUST implement all of the food items in the table. [hint: use a dictionary] Here is a sample output of your program. Your program needs to resemble this program completely. In your dictionary, the key should holds the item name and respective value should holds the number counts of that item. If an item is added to the dictionary for the first time, the item name should be added as the key and the value should be 1. Then if the item is added again the value should be incremented by 1 each time. If an item not in the dictionary is called in the functions lookup, show, or subItem then nothing should happen! Remember you are only using the Unicode values in the lookup and show functions

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!