🏆 Project 1: The Ledger of Fate
Congratulations! You have mastered the foundations of Python. You know how to:
- Output data (
print) - Store data (
variables) - Categorize data (
int,str,bool) - Calculate data (
math) - Evaluate data (
if/elif/else)
Now, it is time to combine them into a single program: a Text-Based Adventure Game.
📜 The Mission
You are trapped in a digital vault. To escape, you must navigate through three "Nodes" by making choices. Your program must track your Health, your Inventory, and your Decisions.
🛠️ Requirements
Your code must include the following:
- At least 3 Variables: (e.g.,
player_name,health,has_key). - Input handling: Use
input()to get choices from the user. (Note:input()always returns a String, so remember to compare it to strings like"1"or"left"!) - Nested Logic: An
ifstatement inside anotherifstatement. - A Win/Loss Condition: The game must end with either an "Escape" or a "Game Over" message.
🏗️ Starter Template
Python Sandbox
💡 Tips for a Great Game
- The "F-String" Trick: Use
print(f"Health: {health}")to easily put variables inside your text. - Lower Case: Use
.lower()on your inputs so that "Left", "LEFT", and "left" all work:choice = input().lower(). - The "Secret Path": Add a hidden choice that only happens if a specific variable is exactly a certain number.
📤 How to Submit
Once your game is working:
- Copy your code.
- Go to the #🚀-showcase channel in our Discord.
- Post a snippet of your code and a screenshot of a "Victory" run!
Next Steps
You've built your first engine! Now, we need to learn how to handle lots of data at once without creating 100 different variables.