Suppose we have two lists:
A = [2, 3, [6, 7], 0]
B = [4, 7, 10, 2]
I want to input those values to a function like this:
def gettype(self, a):
for x in a:
if isinstance(x, list):
ident = True
else:
ident = False
return ident
That returns True if there are a list of lists or false otherwise.
ident = gettype(A)
print ident
True
ident = gettype(B)
print ident
False
PS: That function above doesn’t work, it’s returning False in both cases
Like