1#Use f-string
2#Example:
3
4x = 2
5y = f'This is a string using variable x: {x}'
6print(y)
7
8#Output:
9#This is a string using variable x: 2
1>>> shepherd = "Mary"
2>>> age = 32
3>>> stuff_in_string = "Shepherd {} is {} years old.".format(shepherd, age)
4>>> print(stuff_in_string)
5Shepherd Mary is 32 years old.
6
1>>> shepherd = "Martha"
2>>> age = 34
3>>> # Note f before first quote of string
4>>> stuff_in_string = f"Shepherd {shepherd} is {age} years old."
5>>> print(stuff_in_string)
6Shepherd Martha is 34 years old.
7