American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

4 PM – Python OOP – Darin

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

Today We:

  1. Continued the MonsterSystem project.
  2. Reviewed some concepts such as dictionaries, objects, and using both together.

Homework:

In a file called Dec2_InheritanceHW.py, do the following and upload it to the google drive when you are done:

  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. Continue by implementing the sword attack damage.
  3. Under the play_adventure method:
    # You have to print a statement like this:
    
    # You attacked dragon with 17 damage and the dragon has 69 health remaining.
    # dragon attacked you with 31 damage. Your remaining health is 908.
    
    # Steps:
    # Get a random damage amount from 10 - 20 to attack the monster
    # Get a random damage amount from 0 to max_attack of the monster to attack the player
    # tip: to get the max_attack value, you need to use 'm'
    
    # reduce player health by the first random damage
    # reduce monster health by the second random damage
    
    # print the information like above.

    Here is a sample output:

    Darin you have 951 health remaining.
    Please choose your monster:
    – Dragon – 86 health – 50 Max attack
    – Troll – 50 health – 20 Max attack
    – Water Golem – 30 health – 20 Max attack
    – Cyclops – 60 health – 30 Max attack
    – Phoenix – 200 health – 100 Max attack
    Enter your selection (enter ‘stop’ to quit the game): troll

    What do you want to do with the troll
    1. Magic attack
    2. Sword attack – 10 to 20 damage
    Enter your selection: 2
    You attacked troll with 12 damage and the troll has 38 health remaining.
    troll attacked you with 12 damage. Your remaining health is 939.

    Darin you have 939 health remaining.
    Please choose your monster:
    – Dragon – 86 health – 50 Max attack
    – Troll – 38 health – 20 Max attack
    – Water Golem – 30 health – 20 Max attack
    – Cyclops – 60 health – 30 Max attack
    – Phoenix – 200 health – 100 Max attack
    Enter your selection (enter ‘stop’ to quit the game): dragon

    What do you want to do with the dragon
    1. Magic attack
    2. Sword attack – 10 to 20 damage
    Enter your selection: 2
    You attacked dragon with 17 damage and the dragon has 69 health remaining.
    dragon attacked you with 31 damage. Your remaining health is 908.

    Darin you have 908 health remaining.
    Please choose your monster:
    – Dragon – 69 health – 50 Max attack
    – Troll – 38 health – 20 Max attack
    – Water Golem – 30 health – 20 Max attack
    – Cyclops – 60 health – 30 Max attack
    – Phoenix – 200 health – 100 Max attack
    Enter your selection (enter ‘stop’ to quit the game):

Notes:

Email me at ddjapri@ayclogic.com if you have any questions.

Details

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