Python: party with Strings | Codementor

Since Python 3.6 a new way to handle strings has become available. Suppose you have variables:
name = “andy”
age = 42
likes = “Python”

and you want to generate a string that says:
“We know someone called andy who is aged 42 and likes to use Python to program.”
It’s now simple and elegant to do that using F-Strings.

Here’s how it works:
print(f”We know someone called {name} who is aged {age} and likes to use {likes} to program.”)
That’s it. No type conversion, concatenation, etc. Just start the string with f before the first “, and enclose all variables in {}.

It works anywhere you need to process a string. Give it a try!

https://www.codementor.io/milesak60/python-party-with-strings-jps4ek1k1