pygame display update( pygame time wait( checkforkeypress(clear out any key presses in the event queue while true if checkforkeypress() pygame event get(clear event queue return def drawscore(score) scoresurf basicfont render('score% (score)truewhite scorerect scoresurf get_rect( scorerect topleft (windowwidth displaysurf blit(scoresurfscorerect def drawworm(wormcoords) for coord in wormcoords coord[' 'cellsize coord[' 'cellsize wormsegmentrect pygame rect(xycellsizecellsize pygame draw rect(displaysurfdarkgreenwormsegmentrect worminnersegmentrect pygame rect( cellsize cellsize pygame draw rect(displaysurfgreenworminnersegmentrect def drawapple(coord) coord[' 'cellsize coord[' 'cellsize applerect pygame rect(xycellsizecellsize pygame draw rect(displaysurfredapplerect def drawgrid() for in range( windowwidthcellsize)draw vertical lines pygame draw line(displaysurfdarkgray( )(xwindowheight) for in range( windowheightcellsize)draw horizontal lines pygame draw line(displaysurfdarkgray( )(windowwidthy) if __name__ ='__main__' main(email questions to the authoral@inventwithpython com