Python Fundamentals / Getting started
Lesson 8 of 38
f-strings
f-strings let you put variables straight into text. Put f before the quote and the variable inside curly brackets.
Key points
- f"...{variable}..."
- You can put maths inside the brackets
- Cleaner than joining with +
name = "Sara"
age = 15
print(f"{name} is {age} years old")Quiz · +10 XP
What will f"{2 + 3} apples" produce?
Log in to save progress and earn XP.