Instagram
youtube
Facebook
Twitter

Concatenate Two Strings Using join() Method

A Python program to concatenate two strings using the join() method without adding any extra space.

Here's the explanation of your code:

  1. str1 = "Hello" – First string is defined.
     
  2. str2 = "World" – Second string is defined.
     
  3. "".join([str1, str2]) – Joins both strings without any space.
     
  4. result = ... – Stores the concatenated string.
     
  5. print(...) – Prints the final output.


Program:

str1 = "Hello"

str2 = "World"

result = "".join([str1, str2])

print("Concatenated String:", result)