+ 1

How do I insert variables into a string?

What do I do if the string starts with a variable?

8th Nov 2021, 3:57 PM
Ben
1 ответ
+ 2
One option is so-called f-strings: x = 42 print(f'The answer is {x}. What is the question?) Another option: Slice the string and concatenate its parts with the variable value.
8th Nov 2021, 4:09 PM
Lisa
Lisa - avatar