American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

8 PM – Python OOP – Joel

November 10 @ 8:00 pm - 9:00 pm

Today we did:
  1. We finished the ShoppingCartApplication2.
Homework:
  1. 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”.
  2. 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.

  3. Create an application loop, and just like today’s project, make a MonsterSystem object, and use that to call the application loop.
  4. 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.
  5. If you have any questions, feel free to email me at joel@ayclogic.com

Details

Date:
November 10
Time:
8:00 pm - 9:00 pm
Verified by MonsterInsights