Last active
August 29, 2015 14:20
-
-
Save vastus/2122ef33e5870f76dea2 to your computer and use it in GitHub Desktop.
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 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