To concatenate two string in python, you have to ask from user to enter the first and second string and start concatenating or appending both the string to form a new string say third string. After concatenation of both the string print the value of the third string as output as shown in the program given below.
Following python program ask from user to concatenate two string:
# Python Program - Concatenate String while True: print("Enter 'x' for exit.") string1 = input("Enter first string: ") string2 = input("Enter second string: ") if string1 == 'x': break else: string3 = string1 + string2 print("String after concatenation =",string3,"\n")
Here is the sample run of the above Python program to demonstrate how to concatenate two string:
You may also like to learn or practice the same program in other popular programming languages: