Learn Python, One Project at a time.

Simple, step-by-step beginner projects using the #1 code editor, Visual Studio Code.

Start Learning

Why Visual Studio Code?

Perfect for Beginners

VS Code is a free, powerful code editor that's easy to start with but grows with you as you become an expert. It's the most popular editor for a reason!

Key Features You'll Use

  • Integrated Terminal: Run your Python code right inside the editor.
  • Python Extension: Get amazing features like syntax highlighting and code suggestions.
  • File Explorer: Easily manage your project files and folders.

Get Your Gear Ready: The Setup Guide

Step 1: Install VS Code on Windows 11

First, we need our code editor. Think of this as your digital workshop.

  1. Go to the official Visual Studio Code download page.
  2. Click the big blue 'Windows' button to download the installer.
  3. Run the installer once it's downloaded. Accept the license agreement and keep clicking 'Next'.
  4. On the 'Select Additional Tasks' screen, make sure 'Add to PATH' is checked. It usually is by default.
  5. Click 'Install', and you're done with step one!

Step 2: Install Python

Now let's install the engine that runs your code. This is Python itself.

  1. Go to the official Python download page.
  2. Click the big yellow 'Download Python' button (it will auto-detect the latest version for you).
  3. Run the installer. THIS IS THE MOST IMPORTANT PART: On the very first screen, check the box at the bottom that says Add Python to PATH.
  4. After checking that box, click 'Install Now' (the default option) and let it finish.

Step 3: Connect Python to VS Code

Last step. We just need to tell VS Code how to talk to Python by installing an extension.

  1. Open Visual Studio Code.
  2. On the left-hand sidebar, click the 'Extensions' icon. It looks like four squares, with one flying off.
  3. In the search bar that appears, type Python.
  4. Click on the first result, the one published by Microsoft. It will have millions of downloads.
  5. Click the blue 'Install' button.

You're all set! You now have a professional-grade coding setup.

Let's go build something!

Let's Build Something!

Project 1: Mad Libs Generator

Learn to get user input and work with strings by building a hilarious word game.

Concepts: input(), f-strings, variables

View Walkthrough

1. Set Up Your File

In VS Code, open the File Explorer (left sidebar), create a new file, and name it madlibs.py.

2. Get User Input

Use the input() function to ask the user for words. Store each word in its own variable.

3. Write the Story

Create a story string that uses your variables. We'll use an f-string (the f before the quotes) to easily insert them.

4. The Code

# madlibs.py

# 1. Get user input
print("Welcome to Mad Libs!")
noun = input("Enter a noun: ")
verb = input("Enter a verb (past tense): ")
adjective = input("Enter an adjective: ")

# 2. Create the story
story = f"The {adjective} {noun} {verb} over the lazy dog."

# 3. Print the story
print("\nHere is your story:")
print(story)

5. Run Your Code

Open the VS Code terminal (View > Terminal) and type python madlibs.py (or python3 madlibs.py) and press Enter!

Project 2: Number Guessing Game

Build a game where the user tries to guess a secret number chosen by the computer.

Concepts: random, while loop, if/else, int()

View Walkthrough

1. Set Up Your File

Create a new file in VS Code named guess_game.py.

2. Import and Generate Number

We need the random module to pick a number. We'll import it at the very top of our file.

3. Create the Game Loop

A while True: loop will keep the game running until the user guesses correctly. We'll use break to exit the loop.

We must convert the user's input to a number using int() to compare it.

4. The Code

# guess_game.py
import random

# 1. Generate secret number
secret_number = random.randint(1, 10)
print("I'm thinking of a number between 1 and 10.")

# 2. Game loop
while True:
    guess_str = input("What's your guess? ")
    guess_num = int(guess_str) # Convert string to number
    
    # 3. Check the guess
    if guess_num < secret_number:
        print("Too low!")
    elif guess_num > secret_number:
        print("Too high!")
    else:
        print(f"You got it! The number was {secret_number}.")
        break # Exit the loop

5. Run Your Code

In your VS Code terminal, type python guess_game.py and play your game!

Project 3: Simple Calculator

Learn how to organize your code with functions by building a basic calculator.

Concepts: def (functions), return, float()

View Walkthrough

1. Set Up Your File

Create a new file in VS Code named calculator.py.

2. Define Functions

Functions let us reuse code. We'll define one for each operation. The return keyword sends a value back.

3. Get User Input

We'll ask the user for two numbers and an operator. We use float() to allow for decimal numbers.

4. The Code

# calculator.py

# 1. Define functions
def add(a, b):
    return a + b

def subtract(a, b):
    return a - b

def multiply(a, b):
    return a * b

def divide(a, b):
    return a / b

# 2. Get user input
print("Welcome to the Simple Calculator!")
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
op = input("Enter operator (+, -, *, /): ")

# 3. Calculate and print
result = 0
if op == '+':
    result = add(num1, num2)
elif op == '-':
    result = subtract(num1, num2)
elif op == '*':
    result = multiply(num1, num2)
elif op == '/':
    result = divide(num1, num2)
else:
    print("Invalid operator!")

print(f"The result is: {result}")

5. Run Your Code

In your VS Code terminal, type python calculator.py to test it out.