I want to have a progress bar starting before the while loop and ending with it as follows:
a = [ '1', '2', '3', '4', '5', '6'] ## This can be 10, 15, 1000 elements b = 5 c = [] timeout = time.time() + 60*b while True: for i in a: if len(a) < 2: print('Ok') elif len(a) >= 2: a.remove(i) time.sleep(10) if len(a) == 2 : print('Achieved results') break elif time.time() > timeout: print('Time ran out') break else: print('Still waiting calculations') pass
I know my timeout is defined by a variable, but it is limited to something i will provide through this parameter, but how do i make a progress bar for all the time calculating this?
And also, how do i break the progress bar once the calculations are done as desired or if the time runs out?
Thank you