Question
In Python, which comparison about String Formatting and f-Strings is accurate?
- There is no practical difference in behavior, performance, or maintainability when String Formatting and f-Strings is involved.
- The oldest option related to String Formatting and f-Strings is always the right production choice regardless of workload or context.
- Differences around String Formatting and f-Strings are mostly cosmetic, so correctness and debugging quality do not really change.
- f-strings improve readability and local formatting control, while concatenation and %-formatting are usually more awkward for new code.
Hint
Focus on the behavior or tradeoff, not just the keyword.
Answer and rationale
Correct answer: D. f-strings improve readability and local formatting control, while concatenation and %-formatting are usually more awkward for new code.
f-strings improve readability and local formatting control, while concatenation and %-formatting are usually more awkward for new code. This is the comparison that usually separates memorization from understanding.
Track: Python