title: How to get keyboard input in pygame?
body: <p>I am making a game in pygame 1.9.2.
  It's a faily simple game in which a ship moves between five columns of bad guys who attack by moving slowly downward. I am attempting to make it so that the ship moves left and right with the left and right arrow keys. Here is my code:</p>
  <pre class="lang-py prettyprint-override"><code>keys=pygame.key.get_pressed()
  if keys[K_LEFT]:
      location-=1
      if location==-1:
          location=0
  if keys[K_RIGHT]:
      location+=1
      if location==5:
          location=4
  </code></pre>
  <p>It works too well. The ship moves too fast. It is near impossible to have it move only one location, left or right. How can i make it so the ship only moves once every time the key is pressed?</p>