Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Work with Strings | Introduction to Python 1/2
Introduction to Python for Data Analysis
course content

Course Content

Introduction to Python for Data Analysis

Introduction to Python for Data Analysis

1. Introduction to Python 1/2
2. Introduction to Python 2/2
3. Explore Dataset
4. Becoming an Analyst

bookWork with Strings

Strings are the standard way to store text. We can use it for storing users' emails, names, etc. You can keep it in different ways.

  • The first way is:
12
string = 'Strings are easy' print(string)
copy
  • The second way is:
12
string = "Strings are easy" print(string)
copy
  • The third way is:
1234
string = ''' Strings are easy ''' print(string)
copy
  • The fourth way is:
1234
string = """ Strings are easy """ print(string)
copy

The first two ways are the most common, and the third and the fourth are used for storing several lines of code.

If you want to put a quotation mark inside the quotes, you can put an ordinary quotation mark inside a double one or vice versa.

1234
string_1 = "I've never learned Python" string_2 = 'I"ve never learned Python' print(string_1) print(string_2)
copy
Choose the INCORRECT ways to define the string.

Choose the INCORRECT ways to define the string.

Select a few correct answers

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 11
some-alt