- This event has passed.
7 PM – Python OOP – Joshua (Gamas Sub)
October 16 @ 7:00 pm - 8:00 pm
Today We Did
- We created oct_16_grocery_v3.py and grocery_item.py.
- We started utilize GroceryItem class to replace the 2 dictionaries from grocery_v2.py.
- Now it is using grocery_dictionary to get the item name and item price.
Homework
- Change the code inside oct_16_grocery_v3.py so it knows how to “add” a new grocery item into the grocery_dictionary properly.
- You need to change the code below so it will add a new GroceryItem object into grocery_dictionary
-
elif selection == "add": food_name = input("Enter food name: ") food_price = int(input("Enter food price: ")) id= input("Enter food id: ") food_id[id] = food_name catalog[food_name]=food_price
-
- You need to change the code below so it will add a new GroceryItem object into grocery_dictionary