evenodd threads

Run Settings
LanguagePython
Language Version
Run Command
# currently not working import threading class thread(threading.Thread): sync_flag = 1 def __init__(self, thread_name, thread_ID): threading.Thread.__init__(self) self.thread_name = thread_name self.thread_ID = thread_ID def run(self): if self.thread_ID == 1: for i in range(1,10): if (i % 2) == 1: #odd if sync_flag == 1: print(i) sync_flag = "even" print("Hello World!") thread_odd = thread("odd", 1) thread_even = thread("even", 2) thread_odd.start() thread_even.start() print("Good bye world")
Editor Settings
Theme
Key bindings
Full width
Lines