Discussion :: Python MCQs
-
What is the result of the expression shown below if x=56.236?
print("%.2f"%x)
Answer : Option B
Explanation :
The expression shown above rounds off the given number to the number of decimal places specified. Since the expression given specifies rounding off to two decimal places, the output of this expression will be 56.24. Had the value been x=56.234 (last digit being any number less than 5), the output would have been 56.23.
Be The First To Comment