0
Please How can I make a program rerun after 30mins
Name=['Anoruo','Onyekachi','Benjamin'] first_name=input("enter first name\n") Last_name=input("enter last name\n") middle_name=input("enter middle name\n") if Name[0]==first_name: if Name[1]==Last_name: if Name[2]==middle_name: for item in Name: print(item) How can I make this rerun every 30mins
2 Answers
+ 3
put the code you want to be rerun every 30min inside a while loop and put time.sleep(30*60) at the end of the loop. This will make your code wait 30*60 seconds = 30min until it executes again. For this to work you have to import time at the beginning of your file.
import time
while True:
#your code
time.sleep(30*60)
Note: There are multiple ways to achieve this and this one is only the simplest one.