Created
December 6, 2015 13:14
-
-
Save jude90/a13261f460efec250ec6 to your computer and use it in GitHub Desktop.
dict with hierarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build(seq): | |
if len(seq) == 0: | |
return None | |
else: | |
head ,tail = seq[0], seq[1::] | |
return {head: build(tail)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment