Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the result of the expression shown below if x=56.236?

    print("%.2f"%x)
  2. A.
    56.00
    B.
    56.24
    C.
    56.23
    D.
    0056.236

    View Answer

    Workspace

    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