# Import the modules that we need for the programfrompicoedimport*# While true, detect if buton A is pressed and also the status of the LEDwhileTrue:ifbutton_a.is_pressed():led.on()else:led.off()
Count the times of pressing the buttons
frompicoedimport*times=0display.show(times)whileTrue:# Press button A once, count minus 1ifbutton_a.was_pressed():times-=1display.show(times)# Press button_B once, add 1 to the countifbutton_b.was_pressed():times+=1display.show(times)