Explanation
In Python, core data types refer to the fundamental building blocks used to store and manipulate data. These core data types include:
Numeric Types:
- int: Integer values, e.g., 5, -10, 1000.
- float: Floating-point values, e.g., 3.14, -0.01, 2.0.
Sequence Types:
- str: Strings, used to represent text, e.g., "hello", 'python'.
- list: Ordered collections of items, e.g., [1, 2, 3], ['apple', 'banana', 'orange'].
- tuple: Immutable ordered collections of items, e.g., (1, 2, 3), ('apple', 'banana', 'orange').
Mapping Type:
- dict: Key-value pairs, e.g., {'name': 'John', 'age': 30}, {'apple': 2.0, 'banana': 1.5}.
Set Types:
- set: Unordered collections of unique items, e.g., {1, 2, 3}, {'apple', 'banana', 'orange'}.
- frozenset: Immutable version of set, e.g., frozenset({1, 2, 3}).
Boolean Type:
- bool: Boolean values, True or False.
None Type:
- None: Represents the absence of a value or a null value.