What is the output of the following Python code snippet?
from decimal import Decimal
print(Decimal('0.1') + Decimal('0.2'))
print(Decimal('0.1') + Decimal('0.2'))
Correct answer
C. 0.3
7 views
C. 0.3
7 views
Decimal uses exact decimal arithmetic when constructed from strings.
Asked in: Python Interview Standard Library
https://docs.python.org/3/library/index.htmlNot sure why the answer is C? Ask here and get an explanation.