I am trying to track a user's decision before a certain time - and to do this, I am asking for input, while setting a timer. I am trying to use these two concurrently, so that the timer will go while there is a query for input. My solution at the moment is not working - could someone please tell me what I need to do to succeed here?
# pft4.py
from multiprocessing import Process
import time
def attack_request():
attack_query = input("Do you want to attack? ")
print(attack_query)
def attack_timer():
timer = 0
for i in range(3):
timer += 1
time.sleep(1)
print("Timer updated: " + str(timer))
return timer
def main():
process_1 = Process(target = attack_request)
process_2 = Process(target = attack_timer)
process_1.run(); process_2.run()
process_1.join(); process_2.join()
# attack_request()
# attack_timer()
if __name__ == "__main__":
main()