Step-by-Step Python Programming Course

Learn Python by reading short explanations, following clear steps, writing code, checking your answers, and correcting your mistakes.

How to Use This Page

This page is designed for students who are beginning to learn Python. Each task is divided into small steps. Read the instructions carefully before writing your code.

Step 1: Read

Read the goal of the task and study the example. Do not copy blindly. Try to understand what each line does.

Step 2: Write

Write your own Python code in the answer box. Use the checklist to make sure your code contains all required elements.

Step 3: Check

Click the button to check your answer. If there is a mistake, read the feedback and improve your code.

Step 4: Improve

Correct your code until you get positive feedback. Programming is about testing, fixing and improving.

Python Basics You Need

Printing text

Use print() to show information on the screen.

print("Hello!")

Variables

A variable is like a box with a name. It stores a value.

name = "Julia"
age = 16

Numbers and calculations

You can use Python like a calculator.

a = 10
b = 5
print(a + b)

Conditions

Use if when the program has to make a decision.

score = 70
if score >= 50:
    print("Passed")
else:
    print("Try again")

Loops

A loop repeats an action many times.

for number in range(1, 6):
    print(number)

Lists

A list stores many values in one variable.

fruits = ["apple", "banana", "orange"]
print(fruits[0])

Guided Practice Tasks

Each task has a clear goal, step-by-step instructions, a checklist and a code box.

Task 1: Print Your First Message

Beginner

Goal: Write a program that prints exactly: Hello Python

What to do:
  1. Start with the command print.
  2. Open round brackets: ( and ).
  3. Put the text inside quotation marks.
  4. Make sure the text is exactly Hello Python.

Example structure: print("your text here")

Task 2: Create and Print a Variable

Beginner

Goal: Create a variable called name and print it.

What to do:
  1. Create a variable named name.
  2. Give it a text value, for example your name.
  3. Use print(name) to display the value.
  • Your code must contain name =.
  • Your text value must be inside quotation marks.
  • Your code must contain print(name).

Task 3: Add Two Numbers

Beginner

Goal: Create two number variables and print their sum.

What to do:
  1. Create a variable called a and give it a number.
  2. Create a variable called b and give it another number.
  3. Use print(a + b) to print the result.

Task 4: Calculate a Rectangle Area

Beginner Plus

Goal: Calculate the area of a rectangle using two variables: width and height.

What to do:
  1. Create a variable called width.
  2. Create a variable called height.
  3. Create a variable called area.
  4. The area should be width * height.
  5. Print the area.

Task 5: Use an If Statement

Intermediate

Goal: Check if a student passed a test.

What to do:
  1. Create a variable called score.
  2. Use an if statement.
  3. If score is 50 or more, print Passed.
  4. Otherwise, print Try again.

Task 6: Print Numbers with a Loop

Intermediate

Goal: Use a loop to print numbers from 1 to 10.

What to do:
  1. Start with for number in range(...):.
  2. Use range(1, 11) because the last number is not included.
  3. Inside the loop, print the variable number.
  4. Remember indentation after the colon.

Task 7: Work with a List

Intermediate

Goal: Create a list of three school subjects and print the first subject.

What to do:
  1. Create a list called subjects.
  2. Add at least three subjects, for example "English", "Math", "Python".
  3. Print the first element using subjects[0].

Task 8: Loop Through a List

Intermediate Plus

Goal: Create a list of names and print every name using a loop.

What to do:
  1. Create a list called students.
  2. Add at least three names to the list.
  3. Use a for loop to go through the list.
  4. Print every name inside the loop.

Task 9: Define a Simple Function

Advanced Beginner

Goal: Create a function called greet that prints Hello.

What to do:
  1. Start with def greet():.
  2. Inside the function, write print("Hello").
  3. After the function, call it using greet().

Task 10: Function with a Parameter

Advanced Beginner

Goal: Create a function called greet with one parameter called name. The function should print the name.

What to do:
  1. Define a function: def greet(name):.
  2. Inside the function, print the variable name.
  3. Call the function with a text value, for example greet("Anna").

Mini Projects

Mini Project 1: Student Report

Project

Goal: Write a short program that creates a simple student report.

Your program must:
  1. Create a variable called student.
  2. Create a variable called subject.
  3. Create a variable called points.
  4. Print the student name.
  5. Print the subject.
  6. If points are 50 or more, print Passed.
  7. Otherwise, print Try again.

Mini Project 2: Shopping List

Project

Goal: Create a shopping list and print every item.

Your program must:
  1. Create a list called shopping.
  2. Add at least three items.
  3. Use a for loop.
  4. Print every item from the list.

Teacher Notes

Suggested classroom use: Students can work individually or in pairs. Ask them to complete the tasks in order. After each task, they should explain in one sentence what their code does.

Extension idea: Fast students can modify each program, for example by changing variable names, adding more list elements, or creating extra conditions.

Important: This page checks code structure and common beginner mistakes. It does not run real Python code in the browser.