Hero Adventure

Python Exercises

Create a simple text-based game where a hero collects coins and fights a monster.
This exercise uses strings, numbers, and variables, with light logic and print formatting.

đź’» Instructions

print("Welcome, brave hero " + hero_name + "!")
"Hero Luna has 10 coins and 70 health left. What a survivor!"

đź’ˇ Hints

  • Use arithmetic like coins = coins + found_coins
  • You can combine strings and variables with + or f-strings.
  • Try adding extra actions like finding another treasure or healing!

🕹️ Extension

name = input("Your name: ")
print("Hi " + name)
hero_name = "Luna"
coins = 0
print("Welcome, brave hero " + hero_name + "!")

found_coins = 10
coins = coins + found_coins
print(f"You found a treasure chest with {found_coins} coins!")
print(f"Now you have {coins} coins.")

hero_health = 100
monster_attack = 30
print("A monster attacks! ⚔️")
hero_health = hero_health - monster_attack

if hero_health > 0:
  print(f"You defeated the monster! {hero_name} survives with {hero_health} health left.")
else:
  print("Oh no! You were defeated... Game Over.")

print(f"Hero {hero_name} has {coins} coins and {hero_health} health left.")