- This event has passed.
5 PM – Python Object Oriented Programming – Shawn
July 14, 2023 @ 5:00 pm - 6:00 pm
Today We Did
- Finished and reviewed Supermarket Application
- Learned what inheritance is.
- Started the
MonsterInheritanceproject. Created ourMonsterclass,Dragon, andTroll.
Homework
- Copy pages 168 to 170 in your textbook into a file named
Jul14_InheritanceHW.py - Create a file in your project called
WaterGolem.py.- Create a class called
WaterGolemthat inherits fromMonster - Use
super()to call the constructor, creating aMonsterthat hasWater Golemas its species, and pass in health and max attack as parameters. - Override the
receive_magic_attackfunction.- The Water Golem is immune to
fireattack - If the magic type is water, the damage is halved
- Otherwise, the attack is done normally, as done in
Monster
- The Water Golem is immune to
- Create a class called
Feel free to let me know if you have any questions — reach me at szhuang@ayclogic.com.