1

My function is:

import time

count = int()

while True:
  count += 1
  time.sleep(1)
  if count == 50:
    time.sleep(5)

I need to put a time delay in every multiple of 50.

John Honai
  • 69
  • 5
  • I was about to say that, but I hoped the loop would be in the `do some function` pseudocode he provided. – Nastor Jul 26 '21 at 08:23
  • just use sleep method : `time.sleep(5)` – AMA Jul 26 '21 at 08:23
  • [how-can-i-make-a-time-delay-in-python](https://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python) – Patrick Artner Jul 26 '21 at 08:28
  • Your core question seems to be this: https://stackoverflow.com/questions/8002217/how-do-you-check-whether-a-number-is-divisible-by-another-number-python – mkrieger1 Jul 26 '21 at 08:33
  • I did not make you hurry :) you posted a incomplete & erroneous [mre] of your problem - I merely commented on it and you fixed it - now all looks fine and it may help others after you. – Patrick Artner Jul 26 '21 at 08:47
  • @PatrickArtner Actually am a new one to this stack. Am learning something here.. ! Thanks for the improvisation. – John Honai Jul 26 '21 at 08:51

2 Answers2

1

You can do something like this

import time
for count in range(1000):
    if count %50==0:
        print ('Number divisible by 50')
        time.sleep(5)
0
import time

count = int()

<
count += 1
do some function
>

if (count % 50) == 0:
  time.sleep(5)

This should do it.

Nastor
  • 638
  • 4
  • 15