Concatenating Variables

In Python, we can concatenate two or more different values of the same type by using + operator.

For example:

Create a .py file in the IDE with the following contents:

complex1 = 2 + 5j

complex2 = 3 + 2j

complex = complex1 + complex2

print ('complex1: ', complex1)

print ('complex2: ', complex2)

print ('complex1 + complex2: ', complex)

When you execute it, you will see the following output

Try It Yourself for Better Understaning!