title: Python Turtle - Can't manage to set up boundary for a turtle?
body: <p>I have my hotkeys set up and am able to move turtle around, however when I run the code, nothing happens if i exceed the x and y values.. no errors either. 
  What's wrong? </p>
  
  <pre><code>if (Alex.xcor()&gt;50 or Alex.xcor()&lt;-50) and \
     (Alex.ycor()&gt;50 or Alex.ycor()&lt;-50):
      Alex.goto(0,0)
  </code></pre>
  
  <p>Full code:</p>
  
  <pre><code>import turtle
  import random
  
  #Setting up the screen to work on
  wn=turtle.Screen()
  wn.screensize(500,500)
  
  #Setting up properties of Alex
  Alex=turtle.Turtle()
  Alex.shape('turtle')
  Alex.color('blue')
  
  #Setting up function to turn right by 45 degrees
  def turn_right():
      Alex.right(45)
  
  #Setting up function to turn left by 45 degrees
  def turn_left():
      Alex.left(45)
  
  #Setting up function to go forward by 30 px
  def go_forward():
      Alex.forward(30)
  
  #Setting up function to go backwards by 30 px
  def go_backward():
      Alex.backward(30)
  
  #Setting up keyboard controls for the turtle
  turtle.listen()
  turtle.onkey(go_forward,"w")
  turtle.onkey(turn_left,"a")
  turtle.onkey(turn_right,"d")
  turtle.onkey(go_backward,"s")
  
  
  #Setting up border boundaries
  if (Alex.xcor()&gt;50 or Alex.xcor()&lt;-50) and \
  (Alex.ycor()&gt;50 or Alex.ycor()&lt;-50):
      Alex.goto(0,0)
  </code></pre>