Python Variables Explained
Understand what Python variables are, how they store and reference data, and why Python's variable model is different from other programming languages.
Learn Python programming from scratch
Understand what Python variables are, how they store and reference data, and why Python's variable model is different from other programming languages.
Learn every way to create and assign variables in Python, from basic single assignment to expressions, type hints, and practical patterns beginners use every day.
Learn Python's variable naming rules, including allowed characters, reserved keywords, PEP 8 conventions, and how to choose names that make your code readable.
Learn how to reassign Python variables to new values, how reassignment interacts with mutable and immutable types, and the patterns that keep your code predictable.
Learn how to assign multiple Python variables in a single line using tuple unpacking, swap values without a temporary variable, and use starred expressions for flexible assignments.
Learn how Python developers create constants using uppercase naming, why Python has no const keyword, and how to write code that signals read-only values.
Learn every built-in Python data type including numbers, strings, booleans, collections, and None. Understand which type to use and why types matter.
Learn how Python integers work, including unlimited precision, arithmetic operations, integer literals in different bases, and common integer methods.
Learn how Python floats work with IEEE 754 double precision, why 0.1 + 0.2 is not exactly 0.3, and how to handle floating-point arithmetic correctly.
Learn how Python booleans work as a subclass of integers, how truthiness evaluates any value, and how to use boolean logic in conditions and expressions.
Learn how Python's None singleton represents the absence of a value, when to use None as a default, and how to check for None correctly with the is operator.
Learn how Python's built-in complex number type represents values with real and imaginary parts, how to perform arithmetic, and when to use the cmath module.