Coming SoonGet ready for TEKI-SL Cohort 2! Applications will open soon.Stay Tuned
All labs
beginner 50 minPython

Python: Your First Program

Run real Python in your browser, variables, loops, and logic.

You will learn to

  • Print output and assign values to variables of different data types
  • Format strings dynamically using f-strings
  • Perform mathematical operations
  • Control flow using if/elif/else statements
  • Iterate over sequences using for-loops and lists

Before you start

  • No experience needed

Tools needed

  • The in-browser Jupyter Sandbox (embedded below)

Your workspace

Practise right here. Work through the steps below in this environment.

The notebook runs entirely in your browser (JupyterLite). The first load downloads the Python runtime, give it a minute on slow connections, then it is cached. Use the upload arrow in the file panel to add datasets.

Step-by-step

Tick each task as you finish it, your progress saves on this device.

  1. 1. Hello, World!

    Jupyter Notebooks run code in "cells". In the first cell, type `print("Hello, Salone!")` and run it by pressing Shift+Enter (or clicking the Play button). The `print()` function is how Python displays information to the screen.

    Done when: The output immediately below the cell shows your greeting
  2. 2. Variables and Data Types

    Variables store data. Create three variables in a new cell: a string `name = "Your Name"`, an integer `age = 25`, and a float `height_m = 1.75`. Python automatically knows their types. You can check a type by running `print(type(age))`.

    Done when: You have successfully stored string, integer, and float data in memory
  3. 3. Dynamic text with f-strings

    You can inject variables directly into strings using f-strings. Add an `f` before the quotes and put variables in curly braces: `print(f"My name is {name}, I am {age} years old and {height_m}m tall.")`. Run the cell.

    Done when: A complete, dynamically generated sentence prints to the screen
  4. 4. Maths and operators

    Python excels at math. Let's calculate your birth year. Create a variable `current_year = 2026`. Calculate your birth year using subtraction: `birth_year = current_year - age`. Print the result. Then try finding the remainder of division using the modulo operator `%` (e.g., `10 % 3`).

    Done when: Python correctly calculates and prints your birth year
  5. 5. Making decisions with If Statements

    Programs need to make choices. Write an `if`/`elif`/`else` block that checks your `age`. If `age < 18`, print "You are a minor". Else if `age < 65`, print "You are an adult". Else, print "You are a senior". Indentation (spaces at the start of the line) is strictly required in Python!

    Done when: The correct branch prints based on the value of your age variable
  6. 6. Iterating with For Loops

    Lists can hold multiple items. Create a list of your favorite fruits: `fruits = ["mango", "banana", "pineapple"]`. Write a `for` loop to print each fruit one by one: `for fruit in fruits: print(f"I love {fruit}s")`.

    Done when: The notebook prints a sentence for every item in your list

Finished every step?

Mark the lab complete to record it on this device.

Reflect

If you can answer these in your own words, the lab stuck.

  • What happens if you forget to indent the code inside an `if` statement?
  • How does Python know that `age = 25` is an integer and not a string?
  • Why are f-strings useful compared to manually adding strings together with `+`?
Python: Your First Program, Teki-SL Lab