Screen Link: https://app.dataquest.io/m/169/i%2Fo-bound-programs/8/locking
This is exactly what happens with the
BAL
is written to the standard output, then the output is flushed, with a newline character. This is why you see inconsistent spacing and team names running together, like this:
Now, consider the following code:
import threading
def worker():
print ('Hello World')
thread_list = []
for i in range(4):
thread = threading.Thread(target=worker)
thread_list.append(thread)
thread.start()
No matter how many times I run this program newlines are not getting flushed. Why?
Output:
Hello World
Hello World
Hello World
Hello World