0

I want to imply a condition to the inputs I am using. Example: if_button_b.was_displayed #and target number = 5 then display.show("win") Basically, what I want to do is: #if button b is pressed on 5 in the counting then display win, if not display lose.

closed as off-topic by Ingo, Milliways, Dmitry Grigoryev, Ghanima Mar 9 at 16:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be specific to the Raspberry Pi within the scope defined in the help center." – Ingo, Milliways, Dmitry Grigoryev, Ghanima
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to Raspberry Pi :-) But this is not a question belonging to Raspberry Pi. You better should ask general programming questions at stackoverflow.com. Please take the short Tour and visit the Help Center to get an idea how things work here. – Ingo Feb 25 at 20:52
3

You can use the word and between conditionals, e.g:

if button_a.is_pressed and button_b.is_pressed:
    print("both pressed")
elif button_a.is_pressed:
    print("a pressed")
elif button_b.is_pressed:
    print("b pressed")

Not the answer you're looking for? Browse other questions tagged or ask your own question.