- The division operator in python is used to perform the division operations.
- It divides the left-side values with the right-side value and gives the remainder.
- In other languages, we have only one division operator but in python, we have 2 division operators.
- division.
- floor division.
1.Division: In division when we divide values we get the result in floating type.
It is denoted by the symbol "/".
syntax:(x/y).
Example: write a python code for integers using a division operator.
- x=20
- y=4
- print(x/y)
output:5.0
2.floor division(//): In the floor division when we divide the values we get the whole number only.
It is denoted by the symbol "//".
syntax:(x//y).
Example: write a python program for integer values using floor division.
- x=20
- y=4
- print(x//y)
output: 5
No comments