Phase 1 — Core Foundations
Data Types & None
str, int, float, bool, None, and checking types with type()
Basic data types
You'll need these four every day.
name = "John" # str
age = 25 # int
price = 99.50 # float
is_active = True # bool
is_admin = False # boolNotice the capitalization difference from JS/TS:
| Python | JavaScript |
|---|---|
True | true |
False | false |
None | null |
None
Python's equivalent of null is None:
user = NoneYou'll see this constantly in backend code (for example FastAPI). To check it:
if user is None:
print("User not found")For now, just remember: None means "no value". We'll cover is properly later.
Checking a type
Python has a built-in type() function:
name = "John"
age = 25
print(type(name)) # <class 'str'>
print(type(age)) # <class 'int'>You can also check a type with isinstance():
isinstance(age, int) # True