import threading
import time
def someMethod(x):
time.sleep(20)
print(x);
def someMethod2(x):
time.sleep(1)
print(x);
t1 = threading.Thread(name="t1", target=someMethod(1));
t2 = threading.Thread(name="t2", target=someMethod2(2));
t1.start();
t2.start();
I'd expect the output to be 2 followed by 1 but it is 1 followed by 2. Total time is 21 seconds. How can I make it run in parallel so the output is 2 followed by 1 and both threads run in parallel so the total time is 20 units?