Created
January 20, 2019 01:04
-
-
Save dyno/d8a6ff246c754b2c5906c25d95cf3c49 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
from random import randint, seed | |
a = "what" | |
def f1(): | |
print(a) | |
a = "ever" | |
print(a) | |
def f2(): | |
seed(0) | |
rand_getters = [] | |
for day in range(31): | |
n = randint(1, 100) | |
rand_getters.append(lambda: n) | |
print([rand_getters[day]() for day in range(31)]) | |
def main(): | |
for f in [f1, f2]: | |
try: | |
f() | |
except Exception as e: | |
print(repr(e)) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment