PyPython · Lesson 2 of 14
Variables & Data Types
Python is dynamically typed, which means you don't declare types — Python figures it out. This is either liberating or terrifying depending on your background.
Variables in Python are created by assignment. There's no need for keywords like var, let, or int. The built-in types cover all common use cases: integers, floats, strings, booleans, and None (Python's null).
Python supports multiple assignment in one line, and you can swap variables without a temporary variable — a small but delightful trick.
◆ Note
Python uses snake_case for variable names (my_variable, not myVariable). Constants are written in UPPER_SNAKE_CASE by convention (MAX_RETRIES = 3), though Python doesn't enforce immutability.
Python uses snake_case for variable names (my_variable, not myVariable). Constants are written in UPPER_SNAKE_CASE by convention (MAX_RETRIES = 3), though Python doesn't enforce immutability.