Python String Concatenation
String Concatenation
String concatenation means add strings together.
Use the + character to add a variable to another variable:
Example
Merge variable a with variable
b into variable c:
a = "Hello"
b = "World"
c = a + b
print(c)
Try it Yourself »
Example
To add a space between them, add a " ":
a = "Hello"
b = "World"
c = a + " " + b
print(c)
Try it Yourself »
For numbers, the + character works as a mathematical operator:
If you try to combine a string and a number, Python will give you an error: