Skip to content

Instantly share code, notes, and snippets.

@arsenlosenko
Created March 10, 2018 12:24
Show Gist options
  • Save arsenlosenko/170530bf80017427f3a8d17fe0144c2b to your computer and use it in GitHub Desktop.
Save arsenlosenko/170530bf80017427f3a8d17fe0144c2b to your computer and use it in GitHub Desktop.
implementation of 10PRINT using python
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