- Long Integer
- Floating Point Number
- Complex Number
- Integers can be of any length, it is only limited by the memory available.
- Integers are further classified as:
- Normal integers:
a = 1987
- Octal literals (base 8):
- A number prefixed by 0o (zero and a lowercase “o” or uppercase “O”) will be interpreted as an octal number
a = 0o10
- Hexadecimal literals (base 16):
- Hexadecimal literals have to be prefixed either by “0x” or “0X”.
hex_number = 0xA0F
- Binary literals (base 2):
- Binary literals can easily be written as well. They have to be prefixed by a leading “0”, followed by a “b” or “B”:
x = 0b101010
- Python 2 used to have two integer types: int and long. There is no long integers in Python 3 anymore.
- There is only one “int” type, which contains both “int” and “long” in Python version 3.
Floating Point Number:
- A floating point number is accurate up to 15 decimal places.
- Integer and floating points are separated by decimal points. 1 is integer, 1.0 is floating point number.
a = 13.06; b= 3.1515e-10
- Complex numbers are written in the form, x + yj, where x is the real part and y is the imaginary part.
a = 1+2j
print(a, “is complex number?”, isinstance(1+2j,complex))