Concatenate Strings in Python
Concatenation is the process of joining two or more items into a single. Concatenation of strings is the joining of two or more strings into a single string.
To concatenate two or more strings in Python, we can use Addition Operator +. The operator can take two strings as operands, concatenates the string, and returns the resulting string string.
The syntax of the expression to check concatenate the strings str1 and str2 using Addition Operator is
str1 + str2
We can concatenate more than two strings in a single expression as shown in the following.
str1 + str2 + str3 + str4
1. Concatenate two strings
In the following program, we take two string in str1 and str2 variables, and concatenate them using Addition Operator.
2. Concatenate more than two strings
In the following program, we take three string values in str1, str2, and str3 variables, and concatenate them into output, and print the resulting string to console.
Run Code Copy
str1 = 'apple'
str2 = 'banana'
str3 = 'cherry'
output = str1 + str2 + str3
In this tutorial of Python Examples, we learned how to concatenate two or more strings using Addition operator, with the help of well detailed examples.