The big idea
Python is a programming language that reads almost like English. It is used to build websites, analyse data, control robots, automate boring jobs and train AI models. A Python program is a list of instructions called statements. Python runs them in order, from the top line to the bottom, unless you tell it otherwise.
Programs work with data, so the first two things to learn are values (the data itself, like 15 or "Ama") and variables (names you use to refer to those values).
Explained simply
The print() function shows a value on the screen. Anything in quotes is text and is printed exactly as written:
print("Hello, world!")
print(3 + 4)
Hello, world!
7
Every value has a type, which tells Python what kind of data it is and what you can do with it. The four basic types are:
| Type | Meaning | Examples |
|---|---|---|
int | whole number (integer) | 15, -3, 0 |
float | number with a decimal point | 1.68, 0.5, 2.0 |
str | string: a piece of text | "Ama", "42" |
bool | Boolean: true or false | True, False |
A variable is created the first time you assign to it with =. Read age = 15 as "make the name age refer to the value 15". Think of a variable as a name tag tied to a value, not a box with the value welded inside. If you assign again, the tag simply moves to the new value.