Python String Concatenation

String Concatenation in Python

String Concatenation is the process of joining two or more strings together. In Python, you can concatenate strings using the + operator.

Example: Concatenating Two Strings

You can combine two strings by adding them together with the + operator.

python
1
2
3
4
a = "Hello"
b = "World"
c = a + b
print(c)  # Output: HelloWorld

Adding a Space Between Strings

To add a space between the concatenated strings, include a space " " in the concatenation.

python
1
2
3
4
a = "Hello"
b = "World"
c = a + " " + b
print(c)  # Output: Hello World

Key Points

  • You can concatenate multiple strings using +.
  • Adding a space between strings can be done by adding " ".

Frequently Asked Questions