Skip to main content\(
\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 7.7 The in operator
The word
in is a boolean operator that takes two strings and returns
True if the first appears as a substring in the second:
Activity 7.7.1.
11-9-2: True or False? The word
in is a boolean operator.
Activity 7.7.2.
11-9-3: True or False? The following code returns True.
'i' in 'lime'
-
True
-
Correct! This returns True because there is a string ’i’ within the string ’lime’.
-
False
-
Incorrect! There is an ’i’ in lime, so this will return True. Try again.
Activity 7.7.3.
11-9-4: True or false? The following code returns True.
'hat' in 'chatter'
You have attempted
of
activities on this page.