I have code like this
from random import randint
def rand(p):
a = randint(0, p)
b = randint(0, p)
while (a != 501) and (b != 370):
a = randint(0, p)
b = randint(0, p)
print(a, b)
rand(1000)
After some iterations it gets out of the loop, but it doesn't print 501 and 370. It always prints 501 or 370. I have no clue why this is happening. I tried without parentheses in while loop and to put everything in them and It still doesn't seem to work.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…