Q:

Python | Concatenate two strings and assign in another string by using + operator

belongs to collection: Python String Programs

0

Example:

Input:
str1 = "Hello"
str2 = "World"

str3 = str1 + ' ' + str2
Output:
str3 = "Hello World"

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

# Python program of concatenate operator 

# input strings 
str1 = "Hello"
str2 = "World"

# concatenate and assign in another string 
str3 = str1 + ' ' + str2

# print strings
print "str1: ",str1
print "str2: ",str2 
print "str3: ",str3

Output

str1:  Hello
str2:  World
str3:  Hello World

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Python String Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Python | Check if a substring presents in a string... >>
<< Python | Appending text at the end of the string u...