Unlike Java, idiomatic Python rarely uses string concatenation to combine string literals with other values.
Instead, the format of the final result is written as an interpolated string, a string with embedded code
expressions. Python's interpolated strings are called f
-strings because they are marked with
the letter f
before the first quote mark.
For example, the Python equivalent to the Java expression
"The answer is " + answer + "."
would be
f'The answer is {answer}.'
Any expression that evaluates to a printable value can be written within a pair of curly braces; the placeholders do not have to be single variable names. For instance, the Python equivalent to the Java expression
"The answer is " + (augend + addend) + "."
would be
f'The answer is {augend + addend}.'
By convention, there is normally no whitespace between the expression and the surrounding curly braces. The one exception is when leaving out the whitespace would put two curly braces right next to each other—in that situation single spaces are used instead.
Finish the program to print the summation "one + two = three" using the string variables provided.