Skip to content

Instantly share code, notes, and snippets.

@Redwoodce
Forked from mayankdawar/listOfList.py
Last active January 17, 2023 05:54
Show Gist options
  • Save Redwoodce/dd0661fdd5f7d85b091fb6bafc03f41a to your computer and use it in GitHub Desktop.
Save Redwoodce/dd0661fdd5f7d85b091fb6bafc03f41a 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.
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
test1 = ('hola' in L)
# Test if [5, 8, 7] is in the list L. Save to variable name test2
test2 = ([5, 8, 7] in L)
# Test if 6.6 is in the third element of list L. Save to variable name test3
test3 = (6.6 in L[2])
test3 = False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment