Created
March 10, 2018 12:24
-
-
Save arsenlosenko/170530bf80017427f3a8d17fe0144c2b to your computer and use it in GitHub Desktop.
implementation of 10PRINT using python
This file contains hidden or 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 sys | |
import random | |
PROBABILITY = 40 | |
def print10(): | |
symbols_per_line = 150 | |
symbol_num = 0 | |
while True: | |
if symbol_num == symbols_per_line: | |
print('\n') | |
symbol_num -= 150 | |
if random.randint(1, 100) < PROBABILITY: | |
print('/', end='', flush=True) | |
else: | |
print('\\', end='', flush=True) | |
symbol_num += 1 | |
if __name__ == "__main__": | |
try: | |
print10() | |
except KeyboardInterrupt: | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment