button1_pressed = True
button2_pressed = True
button3_pressed = True
button2_is_not_pressed = True
while button1_pressed and button2_pressed:
print('do some') # this only happens if both the above are True
while button3_pressed:
print('do some2') # theis only happens if button3_pressed is True
if button2_is_not_pressed:
break # this only breaks the inner while loop
break # added an extra break else it would just be stuck in an endless outer loop
Output:
do some
do some2
The following conditions nothing will happen
button1_pressed = False
button2_pressed = True
button3_pressed = True
button2_is_not_pressed = True
while button1_pressed and button2_pressed:
print('do some') # this only happens if both the above are True
while button3_pressed:
print('do some2') # theis only happens if button3_pressed is True
if button2_is_not_pressed:
break # this only breaks the inner while loop
break # added an extra break else it would just be stuck in an endless loop
Output:
button1_pressed
and
button2_pressed
must be returning True even though you think they should not be.