Lesson 2 of 10
Variables & Data Types
In Python, you create a variable by writing a name and assigning a value with =. You do not need to declare the type — Python figures it out automatically.
Common types: int (whole numbers), float (decimals), str (text), bool (True/False).
PYTHON
name = "Ali" # string
age = 25 # integer
price = 19.99 # float
is_active = True # boolean
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>