Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
isinstance and recursion solution in Clear category for How Deep by Olpag
check = lambda args: isinstance(args, tuple)
def how_deep(structure):
if not any(map(check,structure)):
return 1
count = []
for item in structure:
if check(item):
count.append(1 + how_deep(item))
return max(count)
Sept. 20, 2019