Checkpoint 10.5.1.
- True
- Yes, 3.14 is an item in the list alist.
- False
- There are 7 items in the list, 3.14 is one of them.
What is printed by the following statements?
alist = [3, 67, "cat", [56, 57, "dog"], [ ], 3.14, False]
print(3.14 in alist)
in
and not in
are boolean operators that test membership in a sequence. We used them previously with strings and they also work here.alist = [3, 67, "cat", [56, 57, "dog"], [ ], 3.14, False]
print(3.14 in alist)
alist = [3, 67, "cat", [56, 57, "dog"], [ ], 3.14, False]
print(57 in alist)