Following numeric types supported in python
- Integers
x = 5 y = -2 z = 0
- Floating-point numbers
a = 3.14 b = -0.5 c = 2e-4
- Complex numbers
d = 2 + 3j e = -4j f = 1.5 - 2.7j
In Python, you can perform various arithmetic operations on these numbers, such as addition, subtraction, multiplication, and division. For example:
x = 5 y = 2 print(x + y) # Output: 7 print(x - y) # Output: 3 print(x * y) # Output: 10 print(x / y) # Output: 2.5
a = 3.14 b = 2.0 print(a + b) # Output: 5.14 print(a - b) # Output: 1.14 print(a * b) # Output: 6.28 print(a / b) # Output: 1.57
d = 2 + 3j e = 1 - 2j print(d + e) # Output: (3+1j) print(d - e) # Output: (1+5j) print(d * e) # Output: (8-1j) print(d / e) # Output: (-0.4+1.6j)
These are just a few examples of the many ways you can work with numbers in Python.