The number refers to a numeric value. Python supports four types of numbers. These include integers, long integers, floating-point, and complex numbers.
Integers: Whole numbers are referred to as Integers. For example, 5 is an Integer.
There is no limit to the size of an integer that can be represented in Python.
Now we are giving examples of simple operation on numbers:
In this example, we are taking two variables and adding them.
a=90 b=80 c=a+b print(c)
In this example, we are taking two variables, and they are multiplied and printing the result.
a=50 b=60 print(a*b)
This example is dividing any two integers and produces a floating-point number.
a=5 b=2 print(a/b)
Long integers: Bigger whole numbers are called as Long Integers. Every long integer must have ‘l’ or ‘L’ as the suffix. For example, 12345678L is a Long Integer.
Now we are giving an example of a Long integer. This example represents a Long integer by using ‘L’ as the suffix and printing the result.
Floating point: A floating-point number is a whole number followed by a decimal point and the fractional part. For example, 3.23 and 8.56E-2 are two valid floating-point numbers.
It can also be expressed in exponential or scientific notation. For example, the value 315.25 may be written as 3.1525e2 in exponential notation. Here e2 means multiply by 100. Actually, Exponential notation is useful for representing numbers that are either very large or very small in magnitude. For example, 6700000000 may be written as 6.7E9 or 67E8. Similarly, -000000368 is equivalent to
Number of a+bi form(like -5+5i) are complex numbers. Where a forms the real part and b forms the imaginary part of the complex number.
Leave a comment