Python Learning System · Level 01

CodeCourse

Learn Python by actually writing Python. Six levels. Real code. Instant feedback. No installs and no account required.

Python engine loads the first time you press Run — give it a few seconds.

1

Unit 1 · 30–45 min · Beginner

Foundations

Every program starts with two things: telling the computer something (with print), and remembering something (with a variable). Python reads top to bottom, one line at a time, exactly like a recipe.

A variable is just a labeled box. name = "Ava" creates a box called name and puts the text "Ava" inside it. Text goes in quotes — that's called a string. Numbers don't need quotes.

Read this example

name = "Ava"
age = 12
print("Hello,", name)
print(name, "is", age, "years old")

Now try it yourself

practice.py
Press Run to see your output here.

Your turn

  • Add a second variable called favorite_language and print a sentence using it.
  • Change age to your own age and print a sentence with both name and age.
2

Unit 2 · 30–45 min · Beginner

Control Flow

Real programs make decisions. An if statement checks whether something is true, and only runs its block when it is. elif checks another condition, and else catches everything left over.

Comparisons like >=, ==, and != return True or False — that's what if is actually reading.

Read this example

age = 14
if age >= 13:
    print("You're a teenager!")
else:
    print("Not a teenager yet.")

Now try it yourself

practice.py
Press Run to see your output here.

Your turn

  • Add another elif branch for temperatures below 40.
  • Change temperature and re-run until you hit every branch at least once.
3

Unit 3 · 30–45 min · Beginner

Loops

A for loop repeats a block of code once per item in a sequence — like range(5) (the numbers 0 through 4) or a list of names. A while loop repeats as long as a condition stays true.

Loops are how you avoid writing the same line ten times. Anything indented under the loop line runs on every pass.

Read this example

for i in range(5):
    print("Count:", i)

Now try it yourself

practice.py
Press Run to see your output here.

Your turn

  • Add a fourth name to the students list.
  • Change range(5) to range(0, 10, 2) and predict the output before running it.
4

Unit 4 · 45–60 min · Intermediate

Functions

A function is a reusable block of code with a name. You define it once with def, give it inputs called parameters, and it can hand a result back with return.

return is different from printprint just displays something, while return sends a value back so it can be used elsewhere in your program.

Read this example

def greet(name):
    return "Hello, " + name

print(greet("Maya"))

Now try it yourself

practice.py
Press Run to see your output here.

Your turn

  • Write a function is_even(n) that returns True if n is even.
  • Give add a default value for b, like def add(a, b=1):, then call it with just one argument.
5

Unit 5 · 45–60 min · Intermediate

Data Structures

A list holds an ordered collection — ["Ava", "Leo", "Maya"]. A dictionary holds pairs of keys and values — {"Ava": 92, "Leo": 88} — so you can look things up by name instead of position.

Lists have built-in tools like .append() to add an item. Dictionaries have .items() to loop over every key and value at once.

Read this example

students = ["Ava", "Leo", "Maya"]
students.append("Sam")

for student in students:
    print(student)

Now try it yourself

practice.py
Press Run to see your output here.

Your turn

  • Add two more students to grades.
  • Loop over grades and print only students who scored 90 or above.
6

Unit 6 · 60+ min · Capstone

Capstone: Grade Calculator

Time to combine everything — variables, a function, a loop (hiding inside sum()), and an if/elif chain — into one small but real program.

This calculator takes a list of test scores, averages them, and converts that average into a letter grade.

Read this example

def average(scores):
    return sum(scores) / len(scores)

def letter_grade(score):
    if score >= 90:
        return "A"
    elif score >= 80:
        return "B"
    elif score >= 70:
        return "C"
    else:
        return "Needs Improvement"

Now try it yourself

capstone.py
Press Run to see your output here.

Your turn — make it yours

  • Add a second student's list of scores and print their average and letter grade too.
  • Write a function class_average(all_scores) that takes a list of lists and returns the overall average.
  • Change the grade cutoffs to match your own school's grading scale.

That's the whole path — nice work. Questions or want feedback on your capstone?

Email Us Your Code