0
Variables & Types1 / 4

CRASH COURSE

Variables & Types

A variable is a named box that stores a value. You create one with = : name = "Ada".

  • Python has several basic types: str (text), int (whole numbers), float (decimals), and bool (True/False).
  • Use an f-string to mix variables into text: f"Hello {name}" inserts the value of name.
name = "Ada"        # str
age = 36            # int
pi = 3.14159        # float
is_awesome = True   # bool

print(f"{name} is {age} years old.")
print(type(pi))  # <class 'float'>