Data types specify the different sizes and values that can be stored in the variable. For example, Python stores numbers, strings, and a list of values using different data types.
Table of contents
Python is a dynamically typed language; therefore, we do not need to specify the variable’s type while declaring it. Whatever value we assign to the variable based on that data type will be automatically assigned. For example, name = 'Jessa' here Python will store the name variable as a str data type.
No matter what value is stored in a variable (object), a variable can be any type like int, float, str, list, set, tuple, dict, bool, etc.
There are mainly four types of basic/primitive data types available in Python
- Numeric: int, float, and complex
- Sequence: String, list, and tuple
- Set
- Dictionary (dict)