Created
June 21, 2019 20:03
-
-
Save eyaltrabelsi/2e05ea4065804f43e6d72f1a10259dcf to your computer and use it in GitHub Desktop.
Python-tricks dictionary comrehension
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
>>> m = {x: x ** 2 for x in range(5)} | |
>>> m | |
{0: 0, 1: 1, 2: 4, 3: 9, 4: 16} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment