Practice mode Python

In which Python version were f-strings (formatted string literals) introduced?

Correct answer A. Python 3.6

Explanation

Formatted string literals, written with an f prefix such as f"{name}", were added in Python 3.6 by PEP 498. Python 3.8 later added the = specifier for self-documenting expressions, which is why 3.8 is a tempting choice. Older code uses str.format() or the % operator.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.