Skip to main content
Contents
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 16.14 Review - Strings
Practice indexing, slicing, concatenation, repetition, and common string methods.
Subsection 16.14.1 Part A: Read the String
Checkpoint 16.14.1 .
Identify the first character, the last character, the character at index
3, and the length of the string.
Subsection 16.14.2 Part B: Predict the Result
Checkpoint 16.14.2 .
Determine the result of each expression:
word[0] :
word[1:4] :
word + " science" :
"ha" * 2 :
word.upper() :
Subsection 16.14.3 Part C: Match the Method
Checkpoint 16.14.3 .
Match each method to what it does:
lower(),
upper(),
strip(),
replace(),
find().
Subsection 16.14.4 Part D: Fix
Checkpoint 16.14.4 .
The code below has an error. Update it so it runs correctly.
Checkpoint 16.14.5 .
The code below has an error. Update it so it runs correctly.
Checkpoint 16.14.6 .
The code below has an error. Update it so it runs correctly.
Subsection 16.14.5 Part E: Create
Checkpoint 16.14.7 .
Using
name = "Jordan", write code that creates and prints the string βHello, Jordan!β. Then write code that prints only the first three letters of the name.
Subsection 16.14.6 Think About ...
Checkpoint 16.14.8 .
How are strings similar to lists? How are they different?
You have attempted
of
activities on this page.