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:
Checkpoint 7.7.1.
11-9-2: True or False? The word in
is a boolean operator.
True
Correct! in is a boolean operator that takes two strings and returns True if the first is part of the second.
False
Incorrect! in is a boolean operator. Try again.
Checkpoint 7.7.2.
'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.
Checkpoint 7.7.3.
'hat' in 'chatter'
True
Correct! This returns True because there is a string 'hat' within the string 'chatter'.
False
Incorrect! The string 'chatter' contains the substring 'hat'. Try again.