BeginnerCoder

Lesson 3 — f-strings

Put values inside text

An f-string lets you drop a variable straight into a sentence: write f before the opening quote, then put the variable name in {curly braces}.

city = "Paris"
print(f"I live in {city}")

Why it matters: you will print values constantly, and this is the readable way to do it — no more gluing strings together with +.

Tip: anything inside the braces is real Python, so f"{age + 1}" works too.

Want it another way?
Task

Use an f-string to print exactly: Alex is 20 years old

Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.

← Back
Next →
Test your knowledge

A quick 3-question quiz on this lesson — instant feedback.

Enjoying this lesson? Share it.