- This event has passed.
6 PM – Python OOP – Darin
July 23 @ 6:00 pm - 7:00 pm
What We Did Today:
- Finished Supermarket Application
- Reviewed concepts/functions on using Dictionaries such as .values(), .keys(), and .items()
Homework:
Implement MonsterSystem.py and Monster.py and upload the two files into the google drive when you are finished.
# The monster class has the attributes: species (string), health (int), max_attack (int) # The MonsterSystem class has a dictionary with key {monster's name (String)} and value Monster object # Make the menu print out forever and get input from the user, and implement selection 1 and selection 2
class MonsterSystem: def __init__(self): self.menu = """ Please select one of the following 1. Add Monster 2. List all monsters 3. Play Adventure Enter your selection (Enter 'exit' to quit): """ self.monsters = {} def application_loop(self): while True: # some code here m = MonsterSystem() m.application_loop()
Inside of # some code here^ you want to get input using the self.menu the same way we did in Library System, School System, and Supermarket Application.
Continue to create the add monster and list all monster methods.
Notes:
If you have any questions, you can contact me at ddjapri@ayclogic.com