Variables and constants in Python

String concatenation

Joining strings together is called concatenation. The string concatenation operator (symbol) in Python is a plus sign +. 

In Python, we put spaces on either side of operators so our code is easily readable.

Run the following code
# Set two variables
hello = 'Hello'
name = 'Sam'

print('print two strings joined with the plus concatenation operator')
print(hello + name)
print('')

We have successfully output HelloSam, but we need a space between the two words. To do this, we need to concatenate a string that is a blank space between the two words.

Replace the last three lines with the following code to see how to add a space into the concatenation. 

print('print two strings joined with the plus concatenation operator and with a space between the words')
print(hello + ' ' + name) # Note that there is a space between the two quote marks.
print('')