KnowledgeBoat Logo

Computer Science

Following Python code has an expression with all integer values. Why is the result in floating point form?

a, b, c = 2, 3, 6
d = a + b * c/b
print(d)

Python Data Handling

34 Likes

Answer

The output of the above Python code is 8.0. Division operator is present in the expression. The result of Division operator is of float type. Due to implicit conversion, other operand in this expression are also converted to float type and hence the final result is in floating point form.

Answered By

19 Likes


Related Questions