ProgrammingEasyTCS NQT · Wipro pattern

What is printed?

What is printed?
print(type(10 / 5))
  1. A. <class 'float'>
  2. B. 2.0
  3. C. <class 'int'>
  4. D. 2

Correct answer: A. <class 'float'>

In Python 3 the / operator is true division and always returns a float, even when the result is whole (10/5 is 2.0). Use // for integer (floor) division.

More Python Programming questions

Exams that ask this topic