I'm working on a problem where I need to print something every 45 seconds. So I have used time.sleep(45)
and made up the code as below:
import timer
def print_data():
print "Hello World!"
time.sleep(45)
while True:
print_data()
I have a couple of queries which I'm trying to understand and learn. I have re-searched this but couldn't get a answer I'm looking for. Please find my queries below:
How do I print the above content continuously exactly for 1 hour waiting every 45 sec?
Can we give a random value say, 30-45 seconds waiting time. So it can wait for any value between 30-45 seconds ?
How does RAM or CPU behave when I put on the timer for 4 -5 hours refreshing/waiting every 60 seconds ? Does this effect the CPU or RAM in any way ?
Kindly help me in understanding these questions. Any help would be appreciated. Thanks in advance.