Predefined Objects in Python
Predefined Objects in Python
Predefined Objects
in Python
There are several predefined objects and data types in Python. These objects are readily available for use
without the need for any additional imports. Here are some of the most common predefined objects in Python
Numeric Types
int: Integer numbers (e.g., 42, -10)
float: Floating-point numbers (e.g., 3.14, -0.5)
complex: Complex numbers with real and imaginary parts (e.g., 2 + 3j)
Sequence Types
str: Strings of characters (e.g., "hello", 'world')
list: Mutable sequences of elements (e.g., [1, 2, 3])
tuple: Immutable sequences of elements (e.g., (1, 2, 3))
Mapping Types
dict: Mutable collections of key-value pairs (e.g., {'a': 1, 'b': 2})
Set Types
set: Mutable collections of unique elements (e.g., {1, 2, 3})
frozenset: Immutable collections of unique elements (e.g., frozenset({1, 2, 3}))
Boolean Type
bool: Boolean values representing True or False
NoneType
None: A special object representing the absence of a value or a null value.
In the above you came across these two terminologies: Mutable and Immutable. Let’s understand what they
really mean:
Mutable Immutable