Stop repeating button check

if sensor.isPositive() == 1:
     <comands.......>

how do i make it only work right when the button is pressed, so that you must let go and press the button again for the condition to be true again?

change the pulse settings on your sensor
make f something other than 0