Created
June 30, 2019 06:15
-
-
Save melvinkcx/41dee5c62467dc648925a6a3e0ac3b0d to your computer and use it in GitHub Desktop.
Filtering Dictionary in Python 3.7
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
import random | |
data = { | |
1: 1, | |
2: 2, | |
3: 3 | |
} | |
# This will raise an Error | |
for k in data: | |
rand = random.randint(4, 2^31) | |
data[rand] = rand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment