In Python, primitive types are the basic building blocks of all programs. They are the most fundamental data types that cannot be decomposed further. Here are the primitive types used in Python 3.10:
1. Integer (int): Integer is a whole number, positive or negative, without a decimal point. It can be represented in Python with the 'int' keyword.
Example:
a = 10
b = -20
c = 0
2. Float: Float represents real numbers with decimal points. It can be represented in Python with the 'float' keyword.
Example:
a = 3.14
b = -2.5
c = 0.0
3. Boolean (bool): Boolean is a binary data type with two possible values, 'True' or 'False'. It can be represented in Python with the 'bool' keyword.
Example:
a = True
b = False
4. String (str): String is a sequence of characters enclosed with single, double, or triple quotes. It can be represented in Python with the 'str' keyword.
Example:
a = 'Hello World'
b = "123"
c = '''Multiple
line
string'''
5. NoneType: NoneType represents the absence of any value. It can be represented in Python with the 'None' keyword.
Example:
a = None
These are the five primitive data types available in Python 3.10.