Exercise: Concatenate strings and get length
Here, we have three ingredients for a simple bread dough stored in the variables a, b, and c. Combine these strings, separating them by
, and
, and assign the resulting recipe to the variable bread. Then, calculate the length of the resulting string and store it in the variable length.a = 'Flour'
b = 'water'
c = 'salt'
# concatenate a, b and c
# separate with ", and "
bread =
length =
# expected: 'Flour, and water, and salt', 26
print(bread, length)
Python
Setting up Python environment...
Output