Created
March 26, 2013 11:11
-
-
Save Geekfish/5244638 to your computer and use it in GitHub Desktop.
Get a mapping of the reverse values of a given range (1 to 5 here). Improved versions welcome.
This file contains 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
{val: range(5, 0, -1)[key] for key, val in enumerate(range(1, 6))} | |
# {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
As pointed by @docmatrix
str(-1 * int(old_val) + 6)