Context: You’re designing your own game character. Every hero has a name, a power level, and health.
Tasks:
Create a class called Hero.
Use __init__() to store name, power, and health.
Ask the user to input those three values.
Create a hero object from the class.
Print the hero's name using print().
Context: You want to know if your hero is strong enough for battle.
Tasks:
Add a method is_strong() to your Hero class.
It should return True if the hero’s power is above 50.
Use if/else to print either:
"Ready for battle!"
"Needs more training."
Context: You need to collect a team of 3 heroes for your mission.
Tasks:
Use a for loop to ask the user for 3 hero names.
Create a new Hero object for each name.
Store them in a list.
Print each hero’s name using a method inside the class.
Context: Two heroes are training with a friendly duel.
Tasks:
Create two Hero objects with different powers.
Add a method duel(other_hero) to compare their power levels.
Print who wins or if it’s a tie.
Context: Your hero gains XP (experience points) after completing missions.
Tasks:
Add an xp attribute (start at 0).
Add a method gain_xp() that increases XP by 10.
Use a while loop to increase XP until it reaches 100.
Print the XP each time.
Context: Your hero needs to collect items before leaving.
Tasks:
Add an inventory attribute (a list).
Add a method add_item(item) to add to the inventory.
Use a for loop to ask the user to input 3 items.
Add the items to the hero’s inventory.
Context: Your hero is hurt. A health potion can help!
Tasks:
Add a method use_potion() that increases the hero’s health by 20.
Ask the user if they want to use a potion (yes or no).
Use if/else to apply the effect or skip it.
Context: A wild enemy appears and attacks your hero.
Tasks:
Create an Enemy class with a name and attack power.
Add a method attack(hero) that lowers the hero’s health.
Use a while loop to keep attacking until the hero’s health is 0.
Print the hero’s health after each attack.
Context: All new heroes are welcomed to Hero Academy.
Tasks:
Create a method called welcome() that prints:
"Welcome to Hero Academy, [name]!"
Create a list of 3 heroes.
Call the welcome() method for each one using a for loop.
Context: Two players each create a custom hero. They’ll battle until one wins.
Tasks:
Ask the user to input names, power, and health for 2 heroes.
Create both hero objects.
Use a loop to alternate attacks (each turn, one attacks the other).
Reduce health on each hit.
Use if to check when one hero's health is 0.
Print who wins at the end.