def is_table(tab):
if len(tab) != 3:
return False
valid = (-1, 0, 1)
for a in range(0, 3):
if len(tab[a]) != 3:
return False
for b in range(0, 3):
if tab[a][b] not in valid:
return False
return True
When I try to run is_table(((0,0,0),(0,0,0),(0,0,0)))
on console, I get this error:
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'is_table' is not defined
Can anyone explain why? My function is clearly defined, but it still doesn't run on console.