Created
July 12, 2017 14:50
-
-
Save anonymous/56ec943758037387f89538a2b483e8da to your computer and use it in GitHub Desktop.
getopt4 created by britodfbr - https://repl.it/JYgN/4
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, random | |
from time import time | |
def gen_random(op): | |
try: | |
op = int(op) | |
yield { | |
1: time(), | |
2: random(), | |
3: randint(1, 10), | |
}.get(op) | |
except: | |
raise | |
if __name__ == '__main__': | |
a = gen_random(1) | |
b = gen_random('2') | |
c = gen_random('3') | |
print(next(a)) | |
print(next(b)) | |
print(next(c)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment