PYTHON CORE · LESSON 03

Strings

Put words together · about 10 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

Text lives in a box, too.

In a variable, you can store not only a number, but also a word. The word must be surrounded by quotation marks.

animal = "кот"

✦ The name animal keeps the word cat.

STEP 2

Put two pieces of text together.

The + sign connects the lines. The space inside quotation marks is also important: it separates the words.

animal = "кот"
print("Мой " + animal)

✦ It'll work. My cat.

IN-CLASS PRACTICE

Type the code yourself

Reprint the example. Note the space after the word «Мой».

pet = "пёс"
print("Мой " + pet)
Open the editor for class work
HOMEWORK

Solve it yourself

Keep the name «Аня» in name. Output the phrase «Привет, Аня», combining the text and name sign +.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework