Skip to content

Instantly share code, notes, and snippets.

@vastus
Last active August 29, 2015 14:20
Show Gist options
  • Select an option

  • Save vastus/2122ef33e5870f76dea2 to your computer and use it in GitHub Desktop.

Select an option

Save vastus/2122ef33e5870f76dea2 to your computer and use it in GitHub Desktop.
def dicty(n):
d = {}
for i, elem in enumerate(range(1,n + 1)):
d[elem] = n - i
return d
print dicty(5) # => {1: 5, 2: 4, 3: 3, 4: 2, 5: 1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment