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
BeginnerGoal: Write a program that prints exactly: Hello Python
- Start with the command
print. - Open round brackets:
(and). - Put the text inside quotation marks.
- Make sure the text is exactly Hello Python.
Example structure: print("your text here")
Task 2: Create and Print a Variable
BeginnerGoal: Create a variable called name and print it.
- Create a variable named
name. - Give it a text value, for example your name.
- 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
BeginnerGoal: Create two number variables and print their sum.
- Create a variable called
aand give it a number. - Create a variable called
band give it another number. - Use
print(a + b)to print the result.
Task 4: Calculate a Rectangle Area
Beginner PlusGoal: Calculate the area of a rectangle using two variables: width and height.
- Create a variable called
width. - Create a variable called
height. - Create a variable called
area. - The area should be
width * height. - Print the area.
Task 5: Use an If Statement
IntermediateGoal: Check if a student passed a test.
- Create a variable called
score. - Use an
ifstatement. - If
scoreis 50 or more, print Passed. - Otherwise, print Try again.
Task 6: Print Numbers with a Loop
IntermediateGoal: Use a loop to print numbers from 1 to 10.
- Start with
for number in range(...):. - Use
range(1, 11)because the last number is not included. - Inside the loop, print the variable
number. - Remember indentation after the colon.
Task 7: Work with a List
IntermediateGoal: Create a list of three school subjects and print the first subject.
- Create a list called
subjects. - Add at least three subjects, for example
"English","Math","Python". - Print the first element using
subjects[0].
Task 8: Loop Through a List
Intermediate PlusGoal: Create a list of names and print every name using a loop.
- Create a list called
students. - Add at least three names to the list.
- Use a
forloop to go through the list. - Print every name inside the loop.
Task 9: Define a Simple Function
Advanced BeginnerGoal: Create a function called greet that prints Hello.
- Start with
def greet():. - Inside the function, write
print("Hello"). - After the function, call it using
greet().
Task 10: Function with a Parameter
Advanced BeginnerGoal: Create a function called greet with one parameter called name. The function should print the name.
- Define a function:
def greet(name):. - Inside the function, print the variable
name. - Call the function with a text value, for example
greet("Anna").
Mini Projects
Mini Project 1: Student Report
ProjectGoal: Write a short program that creates a simple student report.
- Create a variable called
student. - Create a variable called
subject. - Create a variable called
points. - Print the student name.
- Print the subject.
- If points are 50 or more, print Passed.
- Otherwise, print Try again.
Mini Project 2: Shopping List
ProjectGoal: Create a shopping list and print every item.
- Create a list called
shopping. - Add at least three items.
- Use a
forloop. - 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.