- This event has passed.
8 PM – Python OOP – Joel
November 10 @ 8:00 pm - 9:00 pm
Today we did:
- We finished the ShoppingCartApplication2.
Homework:
- Make a new file called monster.py and make a monster class with these attributes: species, health, max_attack. As always make the constructor. Then, create a method inside the class called ‘get_info’. It will return the string f”{self.species} – {self.health} health – {self.max_attack} max attack”.
- Create a new file called Nov10_monster_system. Create a MonsterSystem class and create the constructor. Inside the constructor, make a variable called main_menu with this menu:
Please select one of the following 1. Add Monster 2. List all monsters 3. Play Adventure Enter your selection (Enter 'exit' to quit):
Still in the constructor, create an empty dictionary called monster_dictionary.
- Create an application loop, and just like today’s project, make a MonsterSystem object, and use that to call the application loop.
- Inside the application loop, make a while True loop, and take the input selection from the user based on the main_menu. If the selection is ‘exit’, break out of the loop. If it is equal to “1”, make a new method called add_monster and call it. If it is equal to “2”, make a new method called list_all_monsters and call it. If it is equal to “3”, make a method called play_adventure_game and call it. The methods can be empty for now.
- If you have any questions, feel free to email me at joel@ayclogic.com