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.

  • 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 '19 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.