title: Raspberry Pi Python Press button and run some code
body: <p>I'm a total noob with Raspberry Pi and Python, and I'm trying to make a simple traffic light simulator with 5 LEDs and a button. Here's my code:</p>
  
  <p>while True:</p>
  
  <pre><code>inputValue = GPIO.input(17)
  if (inputValue == False): #if the button was pushed
      print("Button press ")
  else: #if it wasn't pressed 
      GPIO.output(green_traf_LED, GPIO.LOW) #green T. LED on
      GPIO.output(red_walk_LED, GPIO.LOW) #red W. LED always on
      time.sleep(6)
      GPIO.output(green_traf_LED, GPIO.HIGH) #green T. LED off
      #yellow blinking, red
      for k in range(10):
          #red walk LED still on
          GPIO.output(yellow_traf_LED, GPIO.LOW) #yellow T. LED on
          time.sleep(0.2)
          GPIO.output(yellow_traf_LED, GPIO.HIGH) #yellow T. LED off
          time.sleep(0.2)
      #red, white
      GPIO.output(red_traf_LED, GPIO.LOW) #red T. LED ON
      time.sleep(6)
      GPIO.output(red_traf_LED, GPIO.HIGH) #red T. LED off
  time.sleep(0.3)
  </code></pre>
  
  <p>So basically, when the button isn't pushed, I want my python code to run code x. When the button is pushed, I want it to run code y and afterward, continue running code x until I press it again. But when I run the code, none of the LEDs light up, and when i press the button, the message doesn't appear. I'm 100% certain that the wiring, LED numbering, and button numbering is correct, so what do I need to fix? </p>