Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Use FP, Luke! It's cool brain candy! solution in Creative category for Tree Walker by obone
tree_walker = lambda tree, target: \
int(tree == target) or (0 if type(tree) not in (list, dict) else
sum(tree_walker(node if type(tree) is list else tree[node], target) for node in tree))
May 1, 2020