0.20
+ 0.69
-------
0.89
0.53
x 0.65
------
265
3180
------
0.3445
The number of decimal places is derived from the arithmetic.
0.20
+ 0.69
-------
0.89
0.53
x 0.65
------
265
3180
------
0.3445
The number of decimal places is derived from the arithmetic.
Hi mtf. Thanks for your response. What happens if, say, I want the first equation to print(one_decimal_point) instead of two? β¦
two_decimal_points = Decimal(β0.2β) + Decimal(β0.69β)
β¦ somehow get to an output of β¦
β only 0.9 β¦?
I see your example and it makes sense β¦ but if what you say is true, then why in the lesson for this concept does the example produce a long string of numbers instead of just two decimals like what I wrote in green?
Is it that by adding (in front of the number) the word Decimal, weβre telling the computer to βHey, this number has two decimals so stick with a two decimal result?β Also, the lesson says that Decimal is a data type β¦ which came from inside the decimal library/module right? Data type. Exactly like how strings and boolean are data types too right? So Decimal is NOT a function?
It will be helpful to have the documentation on hand when working with this module, at least until it is committed to memory.
Thank you for this reference. I will study it!