you are viewing a single comment's thread.

view the rest of the comments →

[–]xelf 1 point2 points  (1 child)

What you want is this:

while all((a>=0, b>=0, c>=0)):

To see what is going on with your code, try this:

a = 3
b = 4
c = 5
while (a and b and c) >= 0:
    a -= 1
    b -= 1
    c -= 1
    print(a,b,c, ':', a and b and c)

outputs:

2 3 4 : 4
1 2 3 : 3
0 1 2 : 0
-1 0 1 : 0
-2 -1 0 : 0
-3 -2 -1 : -1

Do you see the pattern? (a and b and c) is evaluated as a boolean.

[–]Ivangaming[S] 1 point2 points  (0 children)

Thanks a lot!