Last active
July 14, 2020 09:55
-
-
Save rec/0a7f6cee04560769b8f1e0cd4b5588be 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 loops_forever(function, *arguments): | |
# Return True if function(*arguments) loops forever | |
# Let's try it out | |
def loops_forever(): | |
while True: | |
print() | |
def loops_once(): | |
running = True | |
while running: | |
running = not running | |
>>> print(loops_forever(loops_forever)) | |
True | |
>>> print(loops_forever(loops_once)) | |
False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment