-3

I am new in python I want to run my while loop for 300seconds or upto 300s After 300seconds it must terminate How I can write program in python Plz help.

usman1644
  • 123
  • 1
  • 2
  • 10

1 Answers1

0

Try something like this, which will loop 300 seconds

import time

start_time = time.time()

while (time.time() - start_time) < 300:
    print("/", end='')

print("End.")