Created
August 7, 2020 20:47
-
-
Save mayankdawar/ea95ea761ae974e23d0b0fa081eaf26d to your computer and use it in GitHub Desktop.
Below, we’ve provided a list of lists. Use in statements to create variables with Boolean values - see the ActiveCode window for further directions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L = [[5, 8, 7], ['hello', 'hi', 'hola'], [6.6, 1.54, 3.99], ['small', 'large']] | |
# Test if 'hola' is in the list L. Save to variable name test1 | |
if 'hola' in L: | |
test1 = True | |
else: | |
test1 = False | |
# Test if [5, 8, 7] is in the list L. Save to variable name test2 | |
if [5,8,7] in L: | |
test2 = True | |
else: | |
test2 = False | |
# Test if 6.6 is in the third element of list L. Save to variable name test3 | |
if 6.6 in L[2]: | |
test3 = True | |
else: | |
test3 = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment