I would like to run 2 programs in parallel, like reminders in mobile but when the count starts it takes input but their will be no output until the time up. Here is the code that I used in python
from time import sleep
from threading import Thread
def timer(time, string):
for i in range(time):
sleep(1)
print(string)
def timestart():
wait = 0
time = list(map(int, input("How long do i have to wait: ").split(':')))
time = time[::-1]
for i in range(len(time)):
if i == 0:
wait += time[i]
else:
wait += (60 ** 1)*time[i]
stri = input("What should i remind You: ")
t1 = Thread(target=timer(wait, stri))
t1.start()
a = {
"Who": "Hello What is your name",
"Good": "Its good to meet you",
"Start": "Its time to start"
}
timestart()
name = a["Who"]
print(a["Good"] + name)
print(a["Start"])
This is the output I got i put bold as output
How long do i have to wait: 30
What should i remind You: Time up
hello
no printing
only input
until time up
Time up
Its good to meet youHello What is your name
Its time to start
I changed to multiprocessing can anyone help me idk how to do this
t1 = Process(target=timer, args=(wait, stri, ))
t1.start()
t1.join()
It gave me the same output