Theory

Strings are text enclosed in quotes.

You can combine (concatenate) strings with +:

first = "Hello"
second = "World"
message = first + " " + second
print(message) # Hello World

You can also repeat strings with *:

print("Ha" * 3) # HaHaHa

Exercises in this lesson

1

Combine Strings

Create two variables: first_name = "John" last_name = "Doe" Combine them into full_name with a space between. Display: John Doe

Easy Points: 15
3

Glue with Plus

The + sign glues strings together exactly as they are: Python adds nothing between them, not even a space. Change the code so it shows Hello, Bob! - with a…

Easy Points: 5
Solve in the playground

Frequently asked questions

What is the lesson “Strings” about?

Learn to work with text (strings) in Python.

How many exercises are in this lesson?

This lesson has 4 exercises.

Do I need to install anything to do the exercises?

No. The code is written and run in the browser.

Next lesson: Conditions →