Last active
August 29, 2015 14:06
-
-
Save denysbutenko/1bae8cb8a40c04b91c7d to your computer and use it in GitHub Desktop.
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
def test_func(test): | |
return dict(zip(test[0::3], map(list, zip(test[1::3], test[2::3])))) | |
if __name__ == '__main__': | |
test_list = range(1, 10) | |
print "====" | |
print "Original list: {0}".format(test_list) | |
print "Transformed into dict: {0}".format(test_func(test_list)) | |
print "====" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment