ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(0.1 + 0.2 + 0.3 == 0.6, 0.6 == 0.3 * 2, 0.3 * 2 == 0.6)
  1. A. False True True
  2. B. True True True
  3. C. False False True
  4. D. False True False

Correct answer: A. False True True

Adding 0.1, 0.2 and 0.3 left to right gives 0.6000000000000001, which is not 0.6. 0.3 * 2 is exactly the double for 0.6, so the other two comparisons hold.

More Python Programming questions

Exams that ask this topic