Oct-16-2018, 11:27 AM
Hello folks ;
I have a small question .
How can I apply "break" for "while " loop but if I have a for loop too ? Here is the example
Can you give some ideas to correct the code? Thank you
I have a small question .
How can I apply "break" for "while " loop but if I have a for loop too ? Here is the example
while True: random.randint() #I compute something else here ,but accordingly I might generate new random values for k in range(self.p.T): for l in range (self.p.N): if self.Itm[k][l]<0: print("negative quantity, generate random periods again") else: breakUntil I have positive quantity I want to generate new random values but my break does not work properly since I have for loop for checking quantity.
Can you give some ideas to correct the code? Thank you