- concat() is a python function predefined in 'operator' module that are able to concat the two string.
Syntax-
operator.concat(string,string)
Example-
string1 is "math"
string2 is "book"
concat(string1,string2) will return 'mathbook'
program-
import operator
print("Enter first string")
s1=input()
print("Enter second string")
s2=input()
#first way of concatination
s=operator.concat(s1,s2)
print("After concatination of both string -",s)
#second way of concatination
s=s1+s2
print("After concatination of both string -",s)
Enter first string
Hello
Enter second string
world
After concatination of both string - Helloworld
After concatination of both string - Helloworld
Enter first string
Tea
Enter second string
water
After concatination of both string - Teawater
After concatination of both string - Teawater