Python syntax error with If/Else statement
Question: hey I need help with a stupid syntax error using the if and else statement.

    
    
         GNU nano 2.2.6                      
    #!/usr/bin/python
    
    print 'ACTIVATED'
    
    import RPi.GPIO as GPIO ## Import GPIO library
    
    GPIO.setmode(GPIO.BOARD) ## Use board pin numbering
    GPIO.setup(40, GPIO.IN) ## Setup GPIO Pin 40 to OUT
    GPIO.input(40) ## Turn on GPIO pin 40
    for x in xrange(10):
      if: GPIO.input(40)
    print ('CHEESE')
      else:
        GPIO.cleanup()
    

heres the error:

    
    
    File "./gid.py", line 12
    if: GPIO.input(40)
      ^
    


Answer: Your `if` needs to have a conditional

    
    
    if: GPIO.input(40) # wrong placing of semicolon with missing conditional
    

it has to be

    
    
    if GPIO.input(40): # correct usage
    

as `GPIO.input(40)` returns a boolean

(Apart from that your `print` indent has mismatched)

