+ 1
How do I insert variables into a string?
What do I do if the string starts with a variable?
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.