Python Data Types
1. Numeric Types
- int: Integer values, e.g., 5, -3
- float: Floating-point values, e.g., 3.14, -0.001
- complex: Complex numbers, e.g., 1 + 2j
2. Sequence Types
- str: String, a sequence of characters, e.g., "hello", "123"
- list: List, an ordered collection of items, e.g., [1, 2, 3], ["apple", "banana"]
- tuple: Tuple, an ordered and immutable collection of items, e.g., (1, 2, 3), ("a", "b")
- range: Range, represents a sequence of numbers, e.g., range(0, 10)
3. Mapping Type
- dict: Dictionary, a collection of key-value pairs, e.g., {"name": "Alice", "age": 30}
4. Set Types
Python Data Types
- set: Set, an unordered collection of unique items, e.g., {1, 2, 3}, {"a", "b"}
- frozenset: Frozenset, an immutable version of set, e.g., frozenset({1, 2, 3})
5. Boolean Type
- bool: Boolean values, True or False
6. Binary Types
- bytes: Immutable sequence of bytes, e.g., b'hello'
- bytearray: Mutable sequence of bytes, e.g., bytearray(b'hello')
- memoryview: Memory view object, e.g., memoryview(b'hello')
7. None Type
- NoneType: Represents the absence of a value, e.g., None