« All Events
6 PM – Python OOP – Bill
August 20, 2022 @ 6:00 pm - 7:00 pm
Today We:
- Practiced more with Classes
- Created a Dog Class
- Created a give_treat method for it
- Learned how to create a list of class instances (list of dogs)
- Learned how to loop through list of class instances
Your HW:
- Create a new file called “Aug_20_PizzaClassHW”
- Create a pizza class with 2 attributes: dough and sauce
- Give it a default attribute (not a parameter in the init method) called toppings which is an empty list
- Create a add_topping method with 1 parameter: topping_to_add and add that topping to the toppings atribute list
- Create a describe pizza method that also loops through the toppings attribute list