Multiline Strings
What if we want to store some large text into one variable? By using large comparison, I mean text in multiple lines.
Fortunately, Python allows us to save multiple lines as one string. To do it, use tripled quotation marks. For example,
12345# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
Note
Like in the previous chapter, you have to use the same quotation marks type (i.e. only single or double).
Swipe to start coding
Assign to variable courses
the following string (contains of 2 rows):
Introduction to Python
String Manipulation in Python
Then print this string into console.
Ratkaisu
Kiitos palautteestasi!
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 4.35Awesome!
Completion rate improved to 4.35
Multiline Strings
What if we want to store some large text into one variable? By using large comparison, I mean text in multiple lines.
Fortunately, Python allows us to save multiple lines as one string. To do it, use tripled quotation marks. For example,
12345# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
Note
Like in the previous chapter, you have to use the same quotation marks type (i.e. only single or double).
Swipe to start coding
Assign to variable courses
the following string (contains of 2 rows):
Introduction to Python
String Manipulation in Python
Then print this string into console.
Ratkaisu
Kiitos palautteestasi!
single
Awesome!
Completion rate improved to 4.35
Multiline Strings
Pyyhkäise näyttääksesi valikon
What if we want to store some large text into one variable? By using large comparison, I mean text in multiple lines.
Fortunately, Python allows us to save multiple lines as one string. To do it, use tripled quotation marks. For example,
12345# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
Note
Like in the previous chapter, you have to use the same quotation marks type (i.e. only single or double).
Swipe to start coding
Assign to variable courses
the following string (contains of 2 rows):
Introduction to Python
String Manipulation in Python
Then print this string into console.
Ratkaisu
Kiitos palautteestasi!