The solution is:
three_decimal_points = Decimal(‘0.2’) + Decimal(‘0.69’)
four_decimal_points = Decimal(‘0.53’) * Decimal(‘0.65’)
I didn’t get the point here, and the solution gives two decimals on three_decimal_points!
Where in the solution it says to the program the number of decimals?
Yeah I got the same result as brugerf:
three_decimal_points = Decimal('0.2') + Decimal('0.69')
The above code only gives a result with 2 decimal points despite the exercise saying it should give 3 decimal points.
The bug has been reported but will invite a team member to examine this topic.
Which part of the code determines how many decimal points there will be?
There is nothing in the instructions or description about there being any way to control it. Reporting as a bug.
This whole section is a mess.
No, this isn’t buggy at all. Hope this helps.
The instruction is to “Fix the floating point math below” so that it reflects 3 decimal places in three_decimal_points variable.
If you notice, it’s an addition problem which will result naturally into 2 decimal result, so you have to correct the “+” to " * " then you’ll get the three decimal places.
# Import Decimal below:
from decimal import Decimal
# Fix the floating point math below:
three_decimal_points = Decimal('0.2') * Decimal('0.69')
four_decimal_points = Decimal('0.53') * Decimal('0.65')
0.138 <— three_decimal_points
0.3445 <— four_decimal_points
Also, the Decimal() knows how many decimals places to use based on what operations you use on your variables. Which is why it gave us 2 decimal places on the addition problem.