Lesson 4 of 5
Strings and f-strings
An f-string embeds expressions directly inside a string: f"…{expression}…".
Formatting included: f"{price:.2f}" prints two decimal places.
name = "Ada"
print(f"Hello {name}, 2 + 2 = {2 + 2}")🎯 Exercise
Using the provided variables, print exactly the sentence Python is 35 years old. computing the age inside the f-string (current - year).
main.py
Loading editor…
Loading Python…
Output
Run your code to see the result here.