Answer to Question #264945 in Python for Jessa May Ramirez

Question #264945

Input two strings in one line, separated by a space.


Concatenate the two strings and print out the result.

1
Expert's answer
2021-11-12T16:31:26-0500
# Python program to demonstrate
# string concatenation
 
 

var1 = "Hello"


var2 = "World"

 
# join() method is used to combine the strings

print("".join([var1, var2]))

 
# join() method is used here to combine 
# the string with a separator Space(" ")

var3 = " ".join([var1, var2])

 

print(var3)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS