The AI Starting Point

Courses / Python Foundations

Python Foundations

Write your first real Python programs: values, decisions, loops and functions, with practice at every step.

4 lessonsAbout 3 hoursComplete beginner

Progress

Loading…

Not sure yet? Get the free starter lesson first.

Enter your email and we will send it to you.

$15 $20
R255 (about $15)

What you will be able to do

  • Run and read a small Python program
  • Store and change information in variables
  • Make decisions with if and repeat work with loops
  • Group steps into your own functions
  • Fix the most common beginner errors

What you need: A computer with Python 3 installed (python.org) or a free online Python editor. No earlier programming needed.

Lessons

  1. 1Your first Python programs40 minutes · Lesson quiz
    • What a program is
    • Showing results with print()
    • Reading errors without panic
    • Worked example: a greeting
    • Try it: three lines
  2. 2Variables and kinds of values40 minutes · Lesson quiz
    • Variables are labelled boxes
    • Kinds of values
    • f-strings for readable output
    • Worked example: a shopping total
    • Try it: a tip calculator
  3. 3Decisions and loops45 minutes · Lesson quiz
    • Questions that give True or False
    • Choosing with if
    • Repeating with loops
    • Worked example: grading
    • Try it: times table
  4. 4Functions and a small project50 minutes · Lesson quiz
    • Functions package steps
    • Using the random module
    • Debugging steps
    • Worked example: a guessing game
    • Project: improve the game

Final project: a quiz game

Build a five-question text quiz stored in a list. Ask each question, count the correct answers with a variable, and print a score at the end using an f-string.

Self-check: your program uses a list, a loop, an if decision and at least one function.

Next steps

  • Take JavaScript Foundations to see the same ideas in a browser language.
  • Take Git and GitHub Basics to save and share your code.
Start lesson 1