title: Moving an object left and right
body: <p>I have a problem with Python and pygame: I have no idea how to make a simple paddle move left and right. Basically I am working on a pong type game for my first project.</p>
  
  <p>After reading a few articles online I thought of a way of how to do this. The code I have so far is:</p>
  
  <pre><code>PADDLE_WIDTH = 50
  PADDLE_HEIGHT = 10
  paddleSpeedX = 0
  p1Paddle = pygame.Rect(10, 430, PADDLE_WIDTH, PADDLE_HEIGHT)
  PADDLE_COLOR = pygame.color.Color("red")
  
  while True:
      for event in pygame.event.get():
          if event.type == KEYDOWN:
              if event.key == K_LEFT:
                  p1Paddle.right = p1Paddle.left + paddleSpeedX - 10
              if event.key == K_RIGHT:
                  p1Paddle.left = p1Paddle.left + paddleSpeedX + 10
              if event.type == QUIT:
                  pygame.quit()
                  sys.exit()
                  pygame.display.update()
  
      pygame.display.update()
  </code></pre>
  
  <p>After entering this code the game runs but I still cannot move the paddle left and right.
  How can I do this?</p>