Different names are used to remember values in Python. These values have different data types which determine what are the operations that can be performed on it.
For e.g.: -Numeric types (int and float) performs arithmetic operations like +, -, *, /, and the Logical type bool takes operations like and, or, etc.
We can’t perform arithmetic operations on logical data types and vice-versa.
In the above image, while we try arithmetic operations on True and False, True is taken as 1 and False is taken as 0. When we do logical operations on integers ‘or’ returns first entered integer whereas ‘and’ returns second entered integer.
In each programming languages, it is necessary to declare the variable with its data type. But in Python, this declaration is not required. Therefore, we actually don’t need to use keywords like int, float to declare the data type of a variable. Rather they inherit type from the value currently assigned to them.
Therefore, first use of a variable is always in an assignment statement.
Various Data Types in Python are:
- Long integers don’t form a separate group in Python. They are included in integer (or ‘int’)
- Range of large numbers in the unlimited subject to available memory.
- A value stored in python can have 53 bits of precision.
- A Boolean True value is non-zero, non-null and non-empty.