- This event has passed.
5 PM – Python OOP – Darin
January 8 @ 5:00 pm - 6:00 pm
Today We Did
- Reviewed how inheritance works through try it yourself number 9-7
- Continued the MonsterInheritance project, creating the initial menu pop up as well as started on using inheritance for creating some of the monsters.
Homework
Re-Upload monster.py and monster_system.py into your folder called MonsterInheritance on the google drive.
- Continue on your MonsterInheritance Project, by creating the other two classes that inherit from the Monster class. Create the Troll class as well as the WaterGolem class. These classes are similar to the Dragon class, and think about how you create the constructor method, where you directly give it its first parameter as in the Dragon class. (note: for the WaterGolem class, use “Water Golem” for the species of the monster)
- Complete the initialize_monsters() method from the MonsterSystem class file by adding the Troll and the WaterGolem into the system.
- Create some error handling code for if the user inputs a wrong selection by adding an else statement in the application_loop() method in the MonsterSystem class.
- This is what the program looks like after the user enters 2 (which calls the display_all_monsters() method in the application_loop() method):
This is what the program looks like after the user enters 1:
Notes
If you have any questions, email me at ddjapri@ayclogic.com !!