Created
August 7, 2020 20:45
-
-
Save mayankdawar/24c8cb312c6be4834fb6c64fb2929f0a to your computer and use it in GitHub Desktop.
Below, a list of lists is provided. Use in and not in tests to create variables with Boolean values. See comments for further instructions.
This file contains hidden or 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
lst = [['apple', 'orange', 'banana'], [5, 6, 7, 8, 9.9, 10], ['green', 'yellow', 'purple', 'red']] | |
#Test to see if 'yellow' is in the third list of lst. Save to variable ``yellow`` | |
if 'yellow' in lst[2]: | |
yellow = True | |
else: | |
yellow = False | |
#Test to see if 4 is in the second list of lst. Save to variable ``four`` | |
if 4 in lst[1]: | |
four = True | |
else: | |
four = False | |
#Test to see if 'orange' is in the first element of lst. Save to variable ``orange`` | |
if 'orange' in lst[0]: | |
orange = True | |
else: | |
orange = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment