I made this box of code and the loop goes on forever, I want the loop to go for 5 seconds then stop completely. (also import time and random are put in above in the code)
I haven't tried much, quite lost on how to do this.
def case1():
start = 1
while True:
int = randint(0,3)
if int < 1:
print('Blue')
sleep(0.05)
elif int < 2:
print('Purple')
sleep(0.05)
elif int <= 3:
print('Pink')
sleep(0.05)
I need the loop to stop, after 5 seconds