f-strings example in Python
Question:
Say you want to display 0.2 kg is the weight of the newt.
You have the following variables:
weight = 0.2
animal = "newt"
How could you do it?
- f"{weight} kg is the weight of the {animal}."
- f"{0.2} kg is the weight of the {newt}."
- f{0.2} kg is the weight of the {animal}.
- "f{0.2} kg is the weight of the {animal}."
Answer:
A - is the correct answer