I got the school assignment, where I need to count several lists in f.e. this list:
['a', ['house', [2], 3], [], [[[2]]], 'b']
I wanted to do without using global.
I tried doing this:
def zoznam_prvkov(zoznam):
z = []
for i in range(len(zoznam)):
if isinstance(zoznam[i], list) == False:
z.append(zoznam[i])
else:
zoznam_prvkov(zoznam[i])
return z
But that returns only [1, 2, 3, 6, 8]