4 PM – Python OOP – Darin
December 2 @ 4:00 pm - 5:00 pm
Today We:
- Continued the MonsterSystem project.
- Got introduced to the concept of inheritance in OOP
Homework:
- Continue in your main.py file for the MonsterSystem project. If you are missing code or a file, look for the file in this google drive: https://drive.google.com/drive/folders/1fjS0f3MTDQRRo3pdQvbsiKnNWPQQqptf?usp=sharing
- We added some predefined monsters in our code already inside of the application loop method, just before we start the while loop.
- Your job is to implement selections 1 and 2.
- Selection 1 is where you an add a new monster object into the dictionary by getting input from the user.
- Selection 2 is where you list all the monsters in the system using a for loop.
- For both selection 1 and 2, refer to the past projects on how to add an Object into a dictionary to store, and how to loop through the dictionary to print out object values.
- Sample output:Please select one of the following
1. Add Monster
2. List all monsters
3. Play Adventure
Enter your selection (Enter ‘exit’ to quit): 2LIST OF ALL MONSTERS
Dragon – Health: 200 – Max Attack: 20
Troll – Health: 150 – Max Attack: 15Please select one of the following
1. Add Monster
2. List all monsters
3. Play Adventure
Enter your selection (Enter ‘exit’ to quit): 1ADD MONSTER
Enter the species of the monster: Unicorn
Enter the health of the monster: 200
Enter the max attack of the monster: 20
Successfully added UNICORN into the system.Please select one of the following
1. Add Monster
2. List all monsters
3. Play Adventure
Enter your selection (Enter ‘exit’ to quit): 2LIST OF ALL MONSTERS
Dragon – Health: 200 – Max Attack: 20
Troll – Health: 150 – Max Attack: 15
Unicorn – Health: 200 – Max Attack: 20
Notes:
Email me at ddjapri@ayclogic.com if you have any questions.