A
A
albertalexandrov2018-09-28 10:19:49
Python
albertalexandrov, 2018-09-28 10:19:49

What number will be written last to the numbers.txt file?

Hey!
I myself answered 9999, but the answer is wrong.

from threading import Thread

def just_print():
  with open('numbers.txt', 'w') as f:
    for i in range(10_000):
      f.write(str(i) + '\n')
  print('finished just_print')


t1 = Thread(target=just_print)
t1.daemon = True
t1.start()

for i in range(10):
  print(i*2)

Answer options:
  1. none of the options
  2. 42
  3. no number will be written to the file
  4. 9999
  5. 7014
  6. code execution does not have a well-defined result
  7. 2916

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question