Skip to content
Sharp

Python Fundamentals · interview question

A bug appears around f-strings and output formatting. What is the strongest first debugging move?

Multiple choiceEasychapter-1-curatedpremiumpython-fundamentalsf-strings-and-output-formatting
python
subtotal = 119.97
shipping = 0
print(f"Subtotal: {subtotal:.2f} | shipping: {shipping:.2f}")
Choose one answer
Answer and explanation

Correct answer

C. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. Messy output makes a correct script harder to trust because the operator cannot tell which number belongs to which rule.

Test yourself on Python Fundamentals

A free test with instant, explained results. No account needed.

Start free test
All Python Fundamentals questions →