What is the output of print(0.1 + 0.2 == 0.3) in Python?
print(0.1 + 0.2 == 0.3)
Correct answer
C. False
5 views
C. False
5 views
Binary floating-point cannot represent 0.1 and 0.2 exactly, so the sum is 0.30000000000000004.
Asked in: Python Interview Data Types
https://docs.python.org/3/library/stdtypes.htmlNot sure why the answer is C? Ask here and get an explanation.