It Dont Work Right :(

Your inputPin may be floating when the button is not pressed. Try connecting a resistor (anything from 1k to 20k) from the inputPin to ground if you don't already have one.

Or you could wire it using internals pull-ups (a search will provide explanations if you don't know hot to do this)