Nov-27-2023, 05:17 PM
(Nov-27-2023, 01:07 PM)deanhystad Wrote: It makes perfect sense to me hat or works. The and loops stops if either comparison is false. True and True == True, True and False == False, False and True == False, False and False == False. SO if a == 9 or if b == 20, the loop stops.
Or works because the only way for the loop to end is for both comparisons to be False: True or True == True, True or False == True, False or True == True, False or False == False. The only way for the loop to end with an or is for a != 9 to be False (a == 9) and b != 20 to be False (b == 20)
Maybe you'll like this better:
while not (a == 9 and b == 20):What is the purpose of this code. It is really strange. Why not set a = 9 and b = 20 and c and d to random numbers?
There is no reason to initialize a, b, c and d to zero.
Why are you using tkinter? If you want a window to pop up and display the results, all you need is an input statement.
from random import randint while True: a = randint(1,16) b = randint(13,29) c = randint(16,34) d = randint(22,40) if a == 9 and b == 20: break print(a, b, c, d) input()
Hello and thanks for reply.
The numbers given for a,b,c,d (i.e. 1-16) are mean numbers combined with standard deviations for each number, to define areas (swing) (i.e.: 1-16,13-29...)
Numbers i.e. 9,20 are part of lottery draw.