def getResponse(direction):
 event.clearEvents()
 while 1:
  for key in event.getKeys():
   if (key in ['escape', 'q']):
    win.close()
    core.quit()
   elif (key in ['down', 'up']):
    if (((key in ['down']) and (direction == (-1))) or ((key in ['up']) and (direction == (+ 1)))):
     return 0
    else:
     return 1
   else:
    print ('hit DOWN or UP (or Esc) (You hit %s)' % key)

def getResponse ( direction ) : event . clearEvents ( ) while 1 : for key in event . getKeys ( ) : if ( key in [ 'escape' , 'q' ] ) : win . close ( ) core . quit ( ) elif ( key in [ 'down' , 'up' ] ) : if ( ( ( key in [ 'down' ] ) and ( direction == ( - 1 ) ) ) or ( ( key in [ 'up' ] ) and ( direction == ( + 1 ) ) ) ) : return 0 else : return 1 else : print ( 'hit DOWN or UP (or Esc) (You hit %s)' % key )
if subject said up when direction was up then increase gamma otherwise .