September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,14 +1,8 @@
|
|||
import random, sys, time
|
||||
import threading
|
||||
import random
|
||||
|
||||
lock = threading.Lock()
|
||||
def echo(text):
|
||||
print(text)
|
||||
|
||||
def echo(s):
|
||||
time.sleep(1e-2*random.random())
|
||||
# use `.write()` with lock due to `print` prints empty lines occasionally
|
||||
with lock:
|
||||
sys.stdout.write(s)
|
||||
sys.stdout.write('\n')
|
||||
|
||||
for line in 'Enjoy Rosetta Code'.split():
|
||||
threading.Thread(target=echo, args=(line,)).start()
|
||||
for text in ["Enjoy", "Rosetta", "Code"]:
|
||||
threading.Timer(random.random(), echo, (text,)).start()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue