Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Merge Strings
course content

Course Content

Data Types in Python

Merge StringsMerge Strings

In programming, there are no insurmountable obstacles; persistent practice can overcome any challenge. Therefore, let us discuss another essential aspect related to strings.

It is valuable to understand how to merge strings. In Python, this is achieved effortlessly by using the + operator. While this may seem obvious, I will provide a detailed explanation as customary. Consider the following example (a well-known string from The Beatles' song 'Tell Me Why').

Note

This process is referred to as "concatenation," and it functions much like glue, essentially combining them together. If we desire strings to appear more legible, it is advisable to include spaces since concatenation does not automatically insert them.

Task

One more task for you, fill the gaps and follow the algorithm:

  1. Print country: Italy.
  2. Print country: Ukraine.
  3. Print country: Egypt.

Everything was clear?

Section 3. Chapter 13
toggle bottom row
some-alt