Python supports various data types, including:
1. Numeric Types:
- `int`: Integer type (e.g., 5, -3).
- `float`: Floating-point type (e.g., 3.14, -0.5).
2. Sequence Types:
- `str`: String type (e.g., 'hello', "world").
- `list`: List type (e.g., [1, 2, 3]).
- `tuple`: Tuple type (e.g., (1, 2, 3)).
3. Set Types:
- `set`: Unordered collection of unique elements (e.g., {1, 2, 3}).
4. Mapping Type:
- `dict`: Dictionary type (e.g., {'key': 'value'}).
5. Boolean Type:
- `bool`: Boolean type, representing True or False.
6. None Type:
- `None`: Special type representing the absence of a value.
7. Binary Types:
- `bytes`: Immutable sequence of bytes (e.g., b'hello').
- `bytearray`: Mutable sequence of bytes.
These data types provide flexibility for handling different kinds of data in Python.
0 Comments