ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(float('-0') == 0.0, str(float('-0')), str(float('+0')))
  1. A. True 0.1 0.0
  2. B. True -0.0 0.0
  3. C. False -0.0 0.0
  4. D. True -1.0 0.0

Correct answer: B. True -0.0 0.0

Negative zero is still equal to zero, but str keeps its sign. A plus sign gives positive zero.

More Python Programming questions

Exams that ask this topic