Previously, we've learned about data types, specifically strings (like "Hello"
) and integers (like 42
).
Engagement Message
Let's see if you remember which type the value 2077
belongs to?
Let's look at the +
symbol again. We know it adds integers: 5 + 10
gives 15
.
But what do you think +
does if you use it between two strings? For example:
"Hello" + " " + "World"
Engagement Message
What might the result look like?
When you use +
with strings, Python joins them together, end-to-end. This joining process is called concatenation.
So, "Hello" + " " + "World"
results in the single string "Hello World"
.
Engagement Message
Is the operation 100 + 50
an example of concatenation? Why or why not?
