American Young Coder (AYC)

AYC logo
Loading Events

« All Events

4 PM – Python OOP – Darin

December 2 @ 4:00 pm - 5:00 pm

Today We:

  1. Continued the MonsterSystem project.
  2. Got introduced to the concept of inheritance in OOP

Homework:

  1. 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
  2. We added some predefined monsters in our code already inside of the application loop method, just before we start the while loop.
  3. Your job is to implement selections 1 and 2.
  4. Selection 1 is where you an add a new monster object into the dictionary by getting input from the user.
  5. Selection 2 is where you list all the monsters in the system using a for loop.
  6. 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.
  7. 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: 15

    Please select one of the following
    1. Add Monster
    2. List all monsters
    3. Play Adventure
    Enter your selection (Enter ‘exit’ to quit): 1

    ADD 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): 2

    LIST 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.

Details

Date:
December 2
Time:
4:00 pm - 5:00 pm
Event Categories:
,
Verified by MonsterInsights