Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Storing Text | Variables and Types
Introduction to Python
course content

Course Content

Introduction to Python

Introduction to Python

1. First Acquaintance
2. Variables and Types
3. Conditional Statements
4. Other Data Types
5. Loops
6. Functions

bookStoring Text

In the first chapter, you learned how to display the message "Hello world!" in Python. This message is known as a string. In Python, strings are used to store text, which can also include numbers.

To store text in Python, you need to surround it with quotation marks (either single or double). For instance, you can store the word "Python" in the language variable and then display it:

1234
# Save string within variable language = 'Python' # Output string print(language)
copy

Note

Quotation marks are mandatory. If you omit them, you'll get an error.

If you want to change an object into a string type, use the str() function.

Assign the course name 'Introduction to Python' to the variable course and output it.

question-icon

Fill in the blanks to complete the task.

# Create variable course

# Output course variable value
print(course)
Introduction to Python

Click or drag`n`drop items and fill in the blanks

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 7
We're sorry to hear that something went wrong. What happened?
some-alt