f-strings
Often you want to mix text and values in one line, like 2 x Notebook. An f-string makes this easy. Put the letter f before the opening quote. Then write a variable, or a calculation, inside curly braces { }. Python replaces each pair of braces with its value.
item = "Notebook"
price = 7.5
quantity = 2
print(f"{quantity} x {item}")
print(f"Total: {price * quantity:.2f}")
Output:
2 x Notebook
Total: 15.00
In the first line, {quantity} becomes 2 and {item} becomes Notebook.
In the second line, Python first calculates price * quantity, which is 15.0. The :.2f after it is a format rule. It means "show this number with exactly 2 digits after the decimal point". That is why you see 15.00.
Without an f-string, you would join the pieces with + and turn each number into text with str(). That is longer, and it is easy to forget a space. Use an f-string whenever text and values appear together.
Build two messages with f-strings in the exercise.