Python’s built-in data types are broadly categorized into simple (primitive) types and complex (collection) types.
42
, -7
.3.14
, -0.001
.2 + 3j
.True
or False
."Hello"
.None
object representing absence of a value.[1, 2, 3]
.(1, 2, 3)
.{1, 2, 3}
.{'name': 'Alice', 'age': 30}
.Understanding the underlying data structures helps to grasp how Python manages data efficiently under the hood.
Other simple types like int
, float
, bool
, and str
have specialized implementations optimized for performance and memory, but are not built on collection data structures.
Iterables are objects capable of returning their elements one at a time, allowing you to loop over them using a for
loop or other iteration contexts.
Python provides many utilities to work with data structures and iterables effectively.
chain
, cycle
, combinations
, and more.lambda
keyword.functools
module).