Q:

Var in python 2.7

Hi I am having a couple of problems with my code (the variables) if anyone knows what is wrong I will be very thankful to hear what I am doing wrong with this as I have been trying for hours on end. Many thanks James.
    import time
import RPi.GPIO as GPIO

# Next we setup the pins for use!
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(17,GPIO.OUT)
GPIO.setup(18,GPIO.OUT)

#foward, left, right

foward = print("Foward")
         GPIO.output(17, True)
         GPIO.output(18, True)
         time.sleep(3) 

left = print("Left")
       GPIO.output(17, True)
       GPIO.output(18, False)
       time.sleep(3)

Right = print("Right")
        GPIO.output(17, False)
        GPIO.output(18, True)
        time.sleep(3)

print('Starting motor sequence!')

while True:
  try:
    foward
    left
    right
    right
    right
    foward
    foward

A:

It looks like you are trying to make foward, left, and right functions. In python functions are defined like:
def left():
    print("Foward")
    GPIO.output(17, True)
    GPIO.output(18, True)
    time.sleep(3) 

And called like:
left()

