Bog'liq Learning Python The Ultimate Guide for Beginners to Coding with
Using Variables in Strings In certain scenarios, you may decide to use a variable, which contains a
value in a string. For instance, you may want to use two variables to hold
the first name and last name of a person, respectively. Additionally, these
two variables must be combined to produce the individual’s full name. Let
us consider how that is possible in Python.
first_name = “johnson”
last_name = “boris”
1. full_name
=
f
“{first_name}
{last_name}”
print(full_name)
If you want to insert a variable value to a string, you have to add the letter
“f” directly before the opening quotation mark