Write a single Python statement to create a variable named twoDecimals. The variable will hold the result of using a Python function to limit the decimal positions included in another variable ( manyDecimals , provided to you below). The resulting variable ( twoDecimals ) should have only two decimal positions.
manyDecimals = 1.2568765214789
Python code:
#initializing manyDecimals
manyDecimals=1.2568765214789
#required single line(line 4), here round is the python function
used to limit the decimal point to 2 decimal positions(by rounding
off) of manyDecimals variable
twoDecimals=round(manyDecimals,2)
#priniting twoDecimals just for your understanding
print(twoDecimals)
Screenshot:
Output:
Get Answers For Free
Most questions answered within 1 hours.