i am very new to coding ,,i started learning threading in python ,,, i achived it but now i want to do a bit diffirent thing but not getting the logic.please help me
from threading import *
import time
def thread1():
for i in range (10):
time.sleep(.2)
print("hello")
class Hello(Thread):
def run(self):
thread1()
class Hi(Thread):
def run(self):
thread1()
t1=Hello()
t2=Hi()
t1.start()
t2.start()
here's the code, so what the code is doing is its printing hello 10 times on 1 thread each, so 20 hello in total but i want it to print only 10 hello,, the threads need to start . lets consider each hello is numbered,so t1 needs to print hello1,hello3,hello5,hello7,hello9. and t2 needs to print hello2,hello4,hello6,hello8,hello10,. thank u