Python all items in list of lists true -
made table of true & false, , i'd check if true. used all() before, reason below fail miserably.
data = [[false, false, false], [false, false, false], [true, true, true], [true, true, true]] print(all(data)) >>> true
why happening?
all
not check bools in each sublist. each of non-empty lists truthy.
to check all items in all sublists true
, should do:
all(x lst in data x in lst) # -> false
Comments
Post a Comment