Recently I have a python While loop function with if features that require special condition to deal with
import time
from random import randint
while True:
bid = randint(1,21)
ask = 20
#Condition 1
if ask >= bid:
print ('Condition 1: ask is bigger!')
time.sleep (0.1)
#Condition 2
else:
print ('Condition 2: bid is bigger!')
time.sleep(0.1)
Instead of letting this infinite loop running, I would like to add another feature saying if 'Condition 1' occur 10 times in the terminal consecutively, it has to print 'Condition 3: Condition 1 occur 10 times already!'
Anyone have any ideas? Many thanks!