> Source URL: /ai-and-sports/projects/1-amazing-achievement/amazing-achievement.basketball.project
---
student_outcomes:
  - use simple statistics to analyze and output an amazing sports achievement
  - understand how to store data in variables (focusing on numbers and text)
  - learn how to print data in a formatted way using simple print statements and f-strings
  - the student should be able to build on the simple version using their AI assistant to make a more impressive output
agent_instructions:
  - fill out the spec below with the core project scaffolding/instructions
  - the project spec should be the core instructional spine for all project variants
  - this spec will be used to create sport-specific variants of the same project e.g. `amazing-achievement.football.project.md`, `amazing-achievement.basketball.project.md`, etc.
---

# Project: The Most Amazing Statistical Achievement in Basketball History

---

## Introduction

What's the most unbelievable thing a basketball player has ever done?

- Kobe Bryant scoring **81 points** in a single NBA game
- Michael Jordan dropping **63 points** in a playoff game
- Stephen Curry hitting **13 three-pointers** in one game
- LeBron James passing **38,000 career points**

### 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 Pack](./amazing-achievement-starter-pack.zip)

Open 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.

```python
print("The most amazing statistical achievement in basketball history:")
print("Kobe Bryant scored 81 points in a single NBA game.")
print("Date: January 22, 2006")
```

### Running the code

Save the file (<Kbd>`Cmd + S`</Kbd> or <Kbd>`Ctrl + S`</Kbd>)

You can run the code by hitting the "play" icon in the top right of the screen. Or, you can open the terminal (<Kbd>`Cmd + ~`</Kbd> or <Kbd>`Ctrl + ~`</Kbd>) 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 basketball history:
Kobe Bryant scored 81 points in a single NBA game.
Date: January 22, 2006
```

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 (<Kbd>`Cmd + L`</Kbd> or <Kbd>`Ctrl + L`</Kbd>) 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.

```python
print("Kobe Bryant scored 81 points in a single game!")
```

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:

```
Kobe Bryant scored 81 points in a single game!
```

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:

```python
player = "Kobe Bryant"
points = 81
date = "January 22, 2006"

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.

```
Kobe Bryant
81
January 22, 2006
```

Strings are pieces of text. You can combine strings with `+` to build a longer sentence:

```python
first = "Kobe"
last = "Bryant"
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.

```python
player = "Kobe Bryant"
points = 81
date = "January 22, 2006"
team = "Los Angeles Lakers"

print(f"{player} scored {points} points in a single game!")
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:

```
Kobe Bryant scored 81 points in a single game!
He played for the Los Angeles Lakers.
This happened on January 22, 2006.
```

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.

```python
player = "Kobe Bryant"
team = "Los Angeles Lakers"
opponent = "Toronto Raptors"

# The Achievement
points = 81
field_goals = 28
free_throws = 18
date = "January 22, 2006"

# Create the stat card
print("╔════════════════════════════════════════╗")
print("    THE GREATEST BASKETBALL GAME")
print("╚════════════════════════════════════════╝")
print()
print(f"  Player: {player}")
print(f"  Team:   {team}")
print(f"  vs:     {opponent}")
print()
print("  ─────────────────────────────────────")
print(f"  POINTS SCORED:    {points}")
print(f"  Field Goals:      {field_goals}")
print(f"  Free Throws:      {free_throws}")
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: Kobe Bryant
  Team:   Los Angeles Lakers
  vs:     Toronto Raptors

  ─────────────────────────────────────
  POINTS SCORED:    81
  Field Goals:      28
  Free Throws:      18
  ─────────────────────────────────────

  Date: January 22, 2006

  "They say records are made to be broken.
   This one never will be."
```

Build the card in small steps:

1. Start with the player, team, opponent, and achievement variables.
2. Add the top border and title lines, then a blank line with `print()` to create spacing.
3. Print the player, team, and opponent lines using f-strings.
4. Add the stat section with a divider line, then print points, field goals, and free throws.
5. 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 <Kbd>`Cmd + L`</Kbd> (or <Kbd>`Ctrl + L`</Kbd>), 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."


---

## Backlinks

The following sources link to this document:

- [>button: 🏀 Basketball](/ai-and-sports/projects/1-amazing-achievement/amazing-achievement.project.llm.md)
