The function takes a list and returns an int depending on how many lists are in the list not including the list itself. (For the sake of simplicity we can assume everything
You can do it with a recursion function :
def count(l): return sum(1+count(i) for i in l if isinstance(i,list))
Demo:
>>> x=[1,2,[[[]]],[[]],3,4,[1,2,3,4,[[]] ] ] >>> count(x) 8