the fill(method is called on line to repaint the entire display surface so that we can start drawing from scratch the four colored buttons are drawn with call to the drawbuttons((explained laterthen the text for the score is created on lines to there will also be text that tells the player what their current score is unlike the call to the render(method on line for the instruction textthe text for the score changes it starts off as 'score and then becomes 'score and then 'score and so on this is why we create new surface objects by calling the render(method on line inside the game loop since the instruction text (--match the pattern by ||never changeswe only need one call to render(outside the game loop on line checking for mouse clicks checkforquit(for event in pygame event get()event handling loop if event type =mousebuttonupmousexmousey event pos clickedbutton getbuttonclicked(mousexmouseyline does quick check for any quit eventsand then line is the start of the event handling loop the xy coordinates of any mouse clicks will be stored in the mousex and mousey variables if the mouse click was over one of the four buttonsthen our getbuttonclicked(function will return color object of the button clicked (otherwise it returns nonechecking for keyboard presses elif event type =keydownif event key =k_qclickedbutton yellow elif event key =k_wclickedbutton blue elif event key =k_aclickedbutton red elif event key =k_sclickedbutton green lines to check for any keydown events (created when the user presses key on the keyboardthe qwaand keys correspond to the buttons because they are arranged in square shape on the keyboard the key is in the upper left of the four keyboard keysjust like the yellow button on the screen is in the upper leftso we will make pressing the key the same as clicking on the yellow button email questions to the authoral@inventwithpython com