- This event has passed.
4:30 PM – Python OOP – Roland
April 4 @ 4:30 pm - 5:30 pm
Today We Did
- Finished LibrarySystem Project
- Fixed bugs in getting info from books and checking whether a books publishing year was before 2000
- Find Book By ID
- Super Secret Password mechanism to exit the program
- Reviewed How Dictionaries Worked
- Dictionaries are like lists except we don’t get items by their index, we use a special magic key that is connected to a value (which is usually an object)
- dictionary[key] = value
- Dictionaries are like lists except we don’t get items by their index, we use a special magic key that is connected to a value (which is usually an object)
Homework
We are going to be starting the SuperMarket project!!!
Before next class please create two files:
One file should be named “shopping_cart_main.py” and the other file should be named “grocery_item.py”
In the grocery_item.py file, create a class called GroceryItem
Make this with this class we can store the attributes: name, price, frozen_food and make it so we can initialize them in the constructor (__init__)
(Feel free to add any more attributes or methods you want in the GroceryItem class but that should be the bare minimum)
Import this GroceryItem class from grocery_item.py into shopping_cart_main.py at the top of the file using import
If you have any questions, feel free to email me at rolandyang@ayclogic.com