>>> tree=((),((),((),((),(),((),)))),((),()))
>>> tree
((), ((), ((), ((), (), ((),)))), ((), ()))
>>> def height(tree):
...   if len(tree) == 0:
...     return 1
...   else:
...     return 1+max(map(height, tree))
...
>>> height(tree)
6


-- 
xmpp: berda...@gmail.com
bitmessage: BM-2cTYXfGiSTsnx3righ6aHcJSWe4MV17jDP
gpg fingerprint: 3F8D53518012716C4EEF7DF67B498306B3BF75A0 (used just
for signing commits)
_______________________________________________
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python

Rispondere a