🎙 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 5 of 14

Which f-string prints 3.14159 as 3.14?

Which f-string prints 3.14159 as 3.14?

  1. A.f"{pi:2}"
  2. B.f"{pi:.2f}"
  3. C.f"{pi:.2}"
  4. D.f"{pi:2f}"
Answer & explanation

Correct answer: f"{pi:.2f}"

".2f" means fixed-point with 2 digits after the decimal point.

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 →