Recall & Review
beginner
What is a string in Python?
A string is a sequence of characters enclosed in quotes, used to represent text.
Click to reveal answer
beginner
How do you create a multi-line string in Python?
Use triple quotes (''' or """) to create a string that spans multiple lines.
Click to reveal answer
beginner
What does the
len() function do when used with a string?It returns the number of characters in the string, including spaces and punctuation.
Click to reveal answer
beginner
How can you combine two strings in Python?
By using the
+ operator to join them together, called concatenation.Click to reveal answer
intermediate
What is the purpose of the
strip() method on a string?It removes any spaces or specified characters from the start and end of the string.
Click to reveal answer
Which of these is the correct way to create a string in Python?
✗ Incorrect
Strings must be enclosed in matching quotes, like double quotes "Hello" or single quotes 'Hello'.
What will
len('Hi there') return?✗ Incorrect
The string 'Hi there' has 8 characters including the space.
What does
'Hello'.upper() do?✗ Incorrect
The upper() method changes all letters in the string to uppercase.
How do you join two strings, 'Good' and 'Morning', with a space in between?
✗ Incorrect
Use the + operator and add a space string ' ' between the two strings.
What does
' hello '.strip() return?✗ Incorrect
strip() removes spaces from both the start and end of the string.
Explain how to create and manipulate strings in Python.
Think about how you write text and change it in Python.
You got /4 concepts.
Describe the difference between single, double, and triple quotes in Python strings.
Consider how you write short vs long text blocks.
You got /3 concepts.