Bit by Bit
← All courses
Programming · Beginner

Python First Steps

Write real code from the first minute, in the editor built into this page. Variables, decisions and loops: the three ideas that every program, including every AI system, is made of.

3 lessons22 minutesFree
Start this course →

Lessons

  1. 1Values and variablesStore values under names and compute with them.7 min
  2. 2Making decisionsMake a program choose what to do.7 min
  3. 3Lists and loopsMake a program repeat work across a whole collection.8 min

What you will learn

Terms explained in this course

statement
One complete line of instruction in a program.
string
A piece of text in a program, written between quotes, such as "hello".
integer
A whole number, such as 7 or −3.
float
A number with a decimal point, such as 3.14.
variable
A name that refers to a stored value, so that the value can be used and changed later.
assignment
Storing a value under a name with the = sign. age = 20 means "let age now refer to 20".
expression
A piece of code that works out to a value, such as 2 + 3 or price * 2.
comment
A note for human readers that Python ignores. It starts with the # sign.
boolean
A value that is either True or False.
condition
An expression that is either True or False, used to make a decision.
comparison operator
A symbol that compares two values, such as > (greater than), < (less than), == (equal to) and != (not equal to).
if statement
Code that runs only when a condition is True. An optional else part runs when it is False.
indentation
The spaces at the start of a line. Python uses them to know which lines belong inside an if or a loop.
list
An ordered collection of values kept under one name, written in square brackets, such as [3, 8, 5].
loop
Code that repeats. A for loop runs once for each item in a collection.
bug
A mistake in a program that makes it behave wrongly.