Lesson 1 of 10

Your first program

Goal

Variables, print and f-strings

01

Explanation

Python reads a lot like English. There are no semicolons at the end of lines, no curly braces around blocks, and you never state a variable's type: writing name = "Layan" is all it takes to create one.

The print() function shows whatever you give it on the screen, and the easiest way to put variable values inside text is an f-string: write the letter f before the opening quote and put each variable inside curly braces.

For example, you write f"My name is {name}" instead of gluing strings together yourself or converting numbers to text.

02

Your task

Define a variable name holding a string and a variable age holding a whole number, then print a single sentence that includes both.

Checks

5 checks
  1. name is a non-empty string
  2. age is a whole number, not a string
  3. The name was printed
  4. The age was printed
  5. Name and age are on the same line
03

Hints

0/3
Track lessons0 of 10 done

Start with the most beginner-friendly language there is, and use it to learn variables, strings, lists, conditions, loops and functions.

Beginner level, 10 lessons, 2 hours in total.

main.py
OutputPython (Pyodide)

Loading Python. This only happens once. Your browser keeps it after that.

–/5

Checks start once the environment is ready.

5 checks listed under “Your task”.

Track lessons0 of 10 done

Start with the most beginner-friendly language there is, and use it to learn variables, strings, lists, conditions, loops and functions.

Beginner level, 10 lessons, 2 hours in total.