On 2013-12-05 14:11, Federico Caboni wrote:

def depth(tree):
        return 1 if not tree else 1+max((depth(t) for t in tree))

penso funzioni anche:

    def depth(tree):
        return 1 + max((depth(t) for t in tree), 0)

-- Daniele

_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a