Why does 3 in [[1, 2, 3]] return False, and how does recursion flatten and search nested lists whose depth you can't know in advance?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
The in operator only ever looks at the top-level elements of the list you hand it.
Two lists are given: flat = [10, 20, 30] and nested = [[10, 20, 30]]. Assign to membership a list of exactly three booleans, in this order:
20 is an element of flat20 is an element of nested20 is an element of the single inner list that nested holdsWrite each entry as a test that Python evaluates for you — do not type True / False out by hand.