← 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?
- A.f"{pi:2}"
- B.f"{pi:.2f}"
- C.f"{pi:.2}"
- 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 →