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 eg:-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 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 it’s data type.But in Python, this declaration is not required.Therefore,we actually don’t need to use keywords like int,float to declare 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 a assignment statement.
Various Data Types in Python are:
- Long integers do not form a separate group in Python.They are included in integer(or ‘int’)
- Range of large numbers in 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.