I am trying to have a program look inside multiple lists to see if there are multiple integers in those lists. I received an answer on a previous question I asked to accomplish that task. However a problem arose with that answer and I can not figure out what it is.
Here is the code:
def all_num_in_list(d, numbers):
for n in numbers:
if n not in d:
return False
return True
def all_num_in_any_list(lists, numbers):
for d in lists:
if all_num_in_list(d, numbers):
return True
return False
while a:
try:
for c, row in enumerate(matrix):
if 0 in row:
print("Found 0 on row:", c, "index:", row.index(0))
if 1 not in row:
if all(row[row.index(0)] != 1 for row in matrix):
if all_num_in_any_list([2, 3, 4, 5, 6, 7, 8, 9], [row, box1, all(row[row.index(0)])]):
if all(row[row.index(0)] != 1 for row in matrix):
print ("t")
The error that it draws is:
if all_num_in_any_list([2, 3, 4, 5, 6, 7, 8, 9], [row, box1, all(row[row.index(0)])]):
TypeError: 'int' object is not iterable
Why is this happening, how can it be avoided, and what exactly is this code doing?
Thanks