- This event has passed.
6:30 PM – Python Object Oriented Programming – Sebastian
April 25, 2023 @ 6:30 pm - 7:30 pm
Today We Did
- Reviewed OOP, dictionaries, and inheritance
- Began creating Monster inheritance program
- In case you need anything, feel free to email me at sebastian@ayclogic.com
Homework
- Name your homework APR25_inheritance_hw, please submit by next Monday.
- Homework: Finish the WaterGolem & Dragon classes:
Dragon: Create receive_magic_attack method taking damage & magic_type parameters. If the magic_type is “fire”, then print “Dragon is immune to fire attack. Therefore, the dragon suffer no damage”. Otherwise, call the receive_magic_attack method from the Monster parent class.
WaterGolem: Create the receive_magic_attack method taking damage & magic_type parameters.
If the magic type is fire, print “Water Golem is immune to fire attack. Therefore, the Water Golem suffer no damage”.
If the magic type is water, print “Water Golem is resistance to water attack. Therefore, your attack is halved.”, and subtract half of the damage parameter from the watergolem’s health.
Otherwise, call the parent’s “receive_magic_attack” method and pass in the damage & magic_type parameters.