How to Concatenate Two Strings in Python

Amansingh Javatpoint
1 min readJun 21, 2021

--

Like the other data types, operations on strings are quite useful when we deal with some real-life applications.

Here we will talk about a simple operation on strings which is concatenation.

Before that, let’s have a glance at what strings are?

Strings are a sequence of characters that are denoted using inverted commas ”. They are immutable which means they cannot be changed once declared. The distinction between two strings can be understood using id().

Examples of a string are-

a=’Bill Gates’

x=’Moscow’

In this article, we will discuss how we can concatenate two strings with the help of the given methods-

  1. Using ‘+’ operator.
  2. Using .format()
  3. Using join()
  4. Using % operator.

So, let’s get started…

  1. The first way which we will see is concatenating two strings using the ‘+’ operator. This operator merges or joins the two given strings.

In the program given below, we have declared six strings and then concatenated them using the ‘+’ operator and stored them in str7 and after that print that value.

--

--