String Concatenation

When we use the plus symbol between strings, we join the strings together. This is called concatenation. For example:

print ('Hello ' + 'world')

In this example, we have used the print function, and we have passed it two strings. The ‘+’ between the strings joins these strings together into one string.

Concatenation is a bit like the links in a chain. Many links are joined together to make a full chain.

Links in a chain are like string concatenation

Notice that this does not add a space between the two strings? In the example above, I’ve added a space after ‘Hello’. What would happen if we didn’t include the space?

print ('Hello' + 'World')

When we join strings, Python does exactly as we ask. That means it won’t add spaces between words. If we want spaces, we need to add them ourselves.