Introduction
What's the most unbelievable thing a volleyball player has ever done?
- Karch Kiraly winning 3 Olympic gold medals (indoor and beach)
- Kerri Walsh Jennings winning 3 Olympic gold medals in beach volleyball
- Earvin N'Gapeth tallying 27 points in a championship match
- Paola Egonu scoring 33 points in a Super Final match
What we're building
By the end of this project, you will:
- Run your first real Python program and see output on screen
- Learn how to store data in variables to organize information
- Display formatted statistics using print statements
- Create a "stat card" showcasing a legendary sports achievement
Why this matters
Every sports broadcast, website, and app displays statistics. The graphics you see on ESPN, the stat overlays during games, the player cards in video games — they're all created by code. Today, you'll write the same kind of code that powers those displays.
Part 1: Quick Start
>button: Download the Starter PackOpen the starter pack in Cursor by going to File > Open Folder and selecting the folder you downloaded from your computer.
You should see a file called amazing_achievement.py. Open it, this is where we will be writing our code.
Writing the code
It's important to type in code manually at first, instead of copying and pasting. This will help your brain learn the code and remember it later. It's similar to playing scales on an instrument. You don't learn to play an instrument by copying someone else's notes, you learn by playing the notes yourself.
print("The most amazing statistical achievement in volleyball history:")
print("Paola Egonu scored 33 points in a Super Final match.")
print("Date: July 17, 2022")
Running the code
Save the file (Cmd + S or Ctrl + S)
You can run the code by hitting the "play" icon in the top right of the screen. Or, you can open the terminal (Cmd + ~ or Ctrl + ~) and type python amazing_achievement.py and press enter.
If everything is working correctly, you should see the output in the terminal:
The most amazing statistical achievement in volleyball history:
Paola Egonu scored 33 points in a Super Final match.
Date: July 17, 2022
If you got an error message, that's OK! You have a helpful AI assistant to help you fix it. Open your AI agent in Cursor (Cmd + L or Ctrl + L) and ask it to help you fix the error.
Congratulations! You just ran (and maybe debugged) your first Python program. The text you see in the terminal is the output of your code.
Part 2: Milestones
We're going to build on the code we wrote in the quick start to make it more impressive.
Milestone 1: Print a Single Stat
For this milestone, we're going to print a single stat about the achievement.
print("Paola Egonu scored 33 points in a single match!")
Now, run your code the same way you did in the quick start.
If everything is working correctly, you should see the output in the terminal:
Paola Egonu scored 33 points in a single match!
Now, let's make it more impressive.
Milestone 2: Store stats in variables
In most real-world programs, you'll want to store data in variables so you can reuse it later.
Python lets us store a variety of different types of data in variables. We're going to focus on numbers and text for now.
Check out the code below:
player = "Paola Egonu"
points = 33
date = "July 17, 2022"
print(player)
print(points)
print(date)
Do you see the name = value syntax? This is how we store data in variables. Notice that some of the values are surrounded by quotes. That means they are text (strings), not numbers. Numbers don't need quotes.
We can print the variables by just putting the variable name in the print() function.
Now, run your code the same way you did in the quick start.
Paola Egonu
33
July 17, 2022
Strings are pieces of text. You can combine strings with + to build a longer sentence:
first = "Paola"
last = "Egonu"
print(first + " " + last)
That works, but there is a cleaner way to mix text and variables using f-strings.
Now we're ready to move on to the next milestone.
Milestone 3: Combine text and variables
Now, let's combine text and variables to create a more impressive output.
Check out the code below. An f-string is a string that starts with f and uses {} to insert variable values.
player = "Paola Egonu"
points = 33
date = "July 17, 2022"
team = "Italy"
print(f"{player} scored {points} points in a single match!")
print(f"He played for the {team}.")
print(f"This happened on {date}.")
Now, run your code the same way you did in the quick start.
If everything is working correctly, you should see the output in the terminal:
Paola Egonu scored 33 points in a single match!
She played for Italy.
This happened on July 17, 2022.
Move on to the next milestone.
Milestone 4: Create a Stat Card Display
Now we're going to get really fancy and create a stat card like you'd see in a sports broadcast (well at least one you might see in the 1980s...).
Check out the code below. It's a bit more complex, but don't worry, we'll break it down step by step.
player = "Paola Egonu"
team = "Italy"
opponent = "Brazil"
# The Achievement
points = 33
kills = 28
aces = 2
date = "July 17, 2022"
# Create the stat card
print("╔════════════════════════════════════════╗")
print(" THE GREATEST VOLLEYBALL MATCH")
print("╚════════════════════════════════════════╝")
print()
print(f" Player: {player}")
print(f" Team: {team}")
print(f" vs: {opponent}")
print()
print(" ─────────────────────────────────────")
print(f" POINTS: {points}")
print(f" Kills: {kills}")
print(f" Aces: {aces}")
print(" ─────────────────────────────────────")
print()
print(f" Date: {date}")
print()
print(" \"They say records are made to be broken.")
print(" This one never will be.\"")
Expected Output:
╔════════════════════════════════════════╗
THE GREATEST SCORING GAME EVER
╚════════════════════════════════════════╝
Player: Paola Egonu
Team: Italy
vs: Brazil
─────────────────────────────────────
POINTS: 33
Kills: 28
Aces: 2
─────────────────────────────────────
Date: July 17, 2022
"They say records are made to be broken.
This one never will be."
Build the card in small steps:
- Start with the player, team, opponent, and achievement variables.
- Add the top border and title lines, then a blank line with
print()to create spacing. - Print the player, team, and opponent lines using f-strings.
- Add the stat section with a divider line, then print points, kills, and aces.
- Finish with the date and the quote.
Wow, congratulations! You just built your first real Python program. You should be proud of yourself.
If you finished early or would like additional challenges, there are a few bonus exercises below.
Bonus Exercises: Push It Further with Your Agent
Use your AI assistant to explore what's possible with the same building blocks you just learned (variables, print statements, and f-strings). Open the AI agent in Cursor with Cmd + L (or Ctrl + L), then type your prompts in the chat panel on the right. Each idea below is meant to be done by prompting your agent and experimenting.
Bonus 1: Make an HTML Stat Page
Goal: Create a new file called amazing_achievement_html.py that writes an HTML page with your stats and some simple styles.
Try prompts like:
- "Write Python code that creates a string of HTML for my stat card, then saves it to a file called
amazing_achievement.html." - "Add basic CSS styles to the HTML so it looks like a simple sports card."
- "Update my Python file to open the HTML file in my browser after saving."
Bonus 2: Build a Multi-Stat Card
Goal: Print two or three achievements in a row, each with its own variables and output.
Try prompts like:
- "Help me duplicate my stat card for another athlete with new variables."
- "Make a function called
print_stat_card(...)so I can reuse it."
Bonus 3: Make It Interactive
Goal: Let the user type in the athlete and stats, then generate the output.
Try prompts like:
- "Show me how to use
input()to ask for the player's name, points, and date." - "Use the inputs to build the same stat card output."
Bonus 4: Add More Formatting
Goal: Experiment with output style and layout.
Try prompts like:
- "Make the stat card wider and center the title."
- "Add a second divider line and align all the numbers."
- "Change the quote at the bottom and add a source line."
Bonus 5: Create a New Format
Goal: Print the same information in a totally different layout.
Try prompts like:
- "Turn the stat card into a scoreboard-style output."
- "Print the stats as a table with columns."
- "Make a 'trading card' layout with a short bio section."