Python Program to Concatenate Strings

Write a Python Program to Concatenate Strings with a practical example.

Python Program to Concatenate Strings Example 1

This Python program allows users to enter two different strings. Next, we used Arithmetic Operator + to concatenate those two strings.

# Python Program to Concatenate Strings

str1 = input("Please Enter the First  String : ")
str2 = input("Please Enter the Second String : ")

concat1 = str1 + str2
print("The Final String After Python String Concatenation = ", concat1)

concat2 = str1 + ' ' + str2
print("The Final After String Concatenation with Space = ", concat2)
Python Program to Concatenate Strings 1

Python Program to Concatenate Strings Example 2

If you are concatenating the string literals, then you can use the following approach. Both these Python approaches work means, with parentheses or without.

# Python Program to Concatenate Strings

concat1 = 'Tutorial ' 'Gateway'
print("The Final String = ", concat1)

concat2 = ('Python ' 'Programming ' 'Examples')
print("The Final String = ", concat2)

Python string concatenation output

The Final String =  Tutorial Gateway
The Final String =  Python Programming Examples