Number Data Type in python
Number data types store numeric values. Number objects are created when you assign a value to them.
For example −
var1 = var2 = 10
You can also delete the reference to a number object by using the del statement. The syntax of the del statement is −
You can delete a single object or multiple objects by using the del statement. For example −
del vardel var_a, var_b
Python supports four different numerical types −
- int (signed integers)
- long (long integers, they can also be represented in octal and hexadecimal)
- float (floating point real values)
- complex (complex numbers)
Here are some examples of numbers −
- Python allows you to use a lowercase l with long, but it is recommended that you use only an uppercase L to avoid confusion with the number 1. Python displays long integers with an uppercase L.
- A complex number consists of an ordered pair of real floating-point numbers denoted by x + yj, where x and y are the real numbers and j is the imaginary unit.