Back to: Python Programming
In computer programming or even in computer system data is the heart. We mainly create new data, save them and when we need we read them, modify them and if the need of them are finished, we just delete them. Numeric data are one of the most data types in Python.
In Python numeric data types are:
- Integers
- Float point numbers
- Complex numbers
Integers: It is also referred as int.
These are the whole positive and negative numbers without any decimal/floating points of unlimited length.
Example:
a = 1
age = 100
money = 100000000000000000000000
x = 2424729724923
credit = -38208420480
Note: Before Python version 3, there we another integer type data type named long. From Python 3, all integer values are part of the Int class. Integers size in now dependent on the CPU architecture.
Floating numbers: It is also referred as float.
These are the positive or negative numbers with decimal or floating point.
Example:
Example:
a = 1.1
Percentage = 33.33
x = -11.11
y = 90.55
float also can hold scientific number with e or E:
Example:
x = 100e5
y = 11E6
z = -66e10
Complex numbers:
Complex numbers can contain a real and an imaginary part. Imaginary part is written with a “j”.
Example:
a = 4+1j
b = 8j
c = -4j
d = 4-3j
Please try yourself to run the code in your IDE.