Python - 3

Python - 3: Strings & Text

Strings are pieces of text in Python. They are written inside quotation marks.

Your challenge: Store text in variables, combine two strings, and print your own message.

✦ Python Editor
▶ Output

Strings use quotation marks

A string can be stored in a variable: message = "Hello!"

Without quotation marks, Python would treat the text as a variable name instead.

Combine strings

Use + to join strings together: first_name + " " + last_name

The " " adds a space between the two names.

Try it: Change the names, then create another string for a favorite activity or hobby.

Good Python habit: Use clear variable names such as first_name and last_name so your code is easy to understand.

👀 Show Example Solution
message = "Welcome to Python!"

print(message)

first_name = "Jamie"
last_name = "Lee"

print(first_name + " " + last_name)

print("I enjoy learning to code!")

The strings are stored in variables, combined with +, and displayed with print().