Google News
logo
Python Program to Division Operator
In the following example of Python program that demonstrates the use of the division operator `/` :
Program :
# Division operator example
a = 10
b = 2
result = a / b

print("The quotient of", a, "and", b, "is", result)


In the above program, we first assign the integer values `10` and `2` to the variables `a` and `b`, respectively. We then use the division operator `/` to divide `a` by `b`, and assign the result to the variable `result`.

Finally, we use the `print()` function to print a message that displays the values of `a`, `b`, and `result`, as well as a message indicating that `result` is the quotient of `a` and `b`.

When we run the program, it will output the following message :

Output :
The quotient of 10 and 2 is 5.0
The program correctly divides `a` by `b` using the division operator `/`, and displays the result using the `print()` function. Note that the result is a floating point number because we are performing a floating point division.