Lesson 2 of 5
Variables and basic types
A variable is a name bound to a value; assignment uses =. Python is dynamically typed.
The basic types: str (text), int (integer), float (decimal), bool (boolean). type(x) returns a value's type.
city = "Berlin" inhabitants = 3_600_000 print(type(city))
🎯 Exercise
Declare a variable language containing the string "Python" and a variable year containing the integer 1991, then print both.
main.py
Loading editor…
Loading Python…
Output
Run your code to see the result here.