Section 1/5f-String Fundamentals
f-String Fundamentals
In this example:f prefix marks an f-stringVariables in {} are replaced with valuesAutomatic string conversion occurs
Mastering f-String Formatting
f-Strings (formatted string literals) provide a readable way to embed expressions inside string literals. They make string formatting concise and maintainable.
f-String Fundamentals
name = "Lina"age = 28print(f"{name} is {age} years old")
→
Lina is 28 years oldIn this example:
fprefix marks an f-string- Variables in
{}are replaced with values - Automatic string conversion occurs