Python - how to continue a loop with absolutely no input, including enter key stroke -


ayy = 0  while true:             ayy = ayy + 1                                       print(randoz(a,b,c,d))                if ayy % 3 == 0:                        omg = input('do wish stop loop?, if yes type yes, if not, type no')         if omg == 'yes':                                 break           if omg == '':     ayy = ayy                    

i trying make loop every 3 laps stops , asks user if wants break, , have option not , continue loop, cant seem figure out how continue without user doing anything, need press enter loop.
randoz function made, non relevent.

you use following code start loop run forever , quit when user adds 'y' or 'y' when prompted input on each third iteration

import itertools in itertools.count(1):      print(randoz(a,b,c,d))      if % 3 == 0:          quit = input('do want quit? y/n')           if quit.lower() == 'y':              break 

example output iterations being printed:

1 2 3 want quit? y/n 4 5 6 want quit? y/n 7 8 9 want quit? y/n 10 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -