Please How can I make a program rerun after 30mins | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

1st May 2021, 10:08 AM
Benjamin
Benjamin - avatar
1 Answer
+ 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.
1st May 2021, 10:17 AM
Hape
Hape - avatar