🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Operators and Input: all 14 questions

Quiz: Python Operators and Input · Question 12 of 14

What does this print? (code)

What does this print?

name = "Ravi"
marks = 87.456
print(f"{name} scored {marks:.1f}")
  1. A.Ravi scored 87.456
  2. B.Ravi scored 87.5
  3. C.Ravi scored 87.4
  4. D.{name} scored {marks:.1f}
Answer & explanation

Correct answer: Ravi scored 87.5

:.1f rounds to one decimal place, and 87.456 rounds to 87.5.

Can you get the rest right without peeking?

Take the timed Quiz: Python Operators and Input quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →