« All Events
4:30 PM – Python OOP – Gamas
April 26, 2022 @ 4:30 pm - 5:30 pm
Today We Do
- We continued with MonsterInheritance project.
Homework
- Inside your MonsterInheritance project, create car.py
- Copy only Car class codes from page 168 into car.py.
- Create electric_car.py and copy only ElectricCar class codes from page 168 into electric_car.py. On the top of this file, import Car class. Look at how we import Monster class inside MonsterInheritanceMain class.
- Inside car.py, add a new method: fill_gas_tank. A method is a function inside a class.
- Inside fill_gas_tank method, print “The gas tank for this car is filled up”.
- Create a new instance of Car class and call the fill_gas_tank method.