American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

4:30 PM – Python OOP – Roland

April 4 @ 4:30 pm - 5:30 pm

Today We Did

  1. 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
  2. Reviewed How Dictionaries Worked
    1. 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)
      1. dictionary[key] = value

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

Details

Date:
April 4
Time:
4:30 pm - 5:30 pm
Verified by MonsterInsights