Oct-16-2018, 12:54 PM
(Oct-16-2018, 11:43 AM)buran Wrote: Not tested but something likeThank you Buran , it worked !!!while True: random.randint() #I compute something else here ,but accordingly I might generate new random values if any(self.Itm[k][l]<0 for k in range(self.p.T) for l in range (self.p.N)): print("negative quantity, generate random periods again") else: breakThere might be better solution but without seeing rest of the code is difficult to say (i.e. I don't like this double for in the comprehension expression)