• Python Basics

  • Python Variables

  • Operators in Python

  • Conditional Statements in Python

  • Python Lists

  • Python Tuples

  • Python Sets

  • Python Dictionaries

  • Loops in Python

  • Python Arrays and Functions

  • Conclusion

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
1a = "Hello"
2b = "World"
3c = a + b
4print(c)  # Output: HelloWorld

Adding a Space Between Strings

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

python
1a = "Hello"
2b = "World"
3c = a + " " + b
4print(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