Built-in types in Python
Python has several **built-in types** that help manage different kinds of data. Here are some key examples: ### Numeric Types - `int` → Whole numbers (`42`, `-7`) - `float` → Decimal numbers (`3.14`, `-0.5`) - `complex` → Complex numbers (`2 + 3j`) ### Sequence Types - `str` → Text (`"Hello, world!"`) - `list` → Ordered collection (`[1, 2, 3]`) - `tuple` → Immutable ordered collection (`(4, 5, 6)`) - `range` → Sequence of numbers (`range(10)`) ### Mapping Type - `dict` → Key-value pairs (`{"name": "Alice", "age": 25}`) ### Set Types - `set` → Unordered unique elements (`{1, 2, 3}`) - `frozenset` → Immutable set (`frozenset({4, 5, 6})`) ### Boolean Type - `bool` → Logical values (`True`, `False`) ### Binary Types - `bytes` → Immutable binary data (`b"hello"`) - `bytearray` → Mutable binary data (`bytearray(b"hello")`) - `memoryview` → Memory-efficient binary handling (`memoryview(b"hello")`)