on line this way the program will alternate between drawing two different background colors remember that this function needs to call pygame display update(to actually make the displaysurf surface appear on the screen telling if the player has won def haswon(revealedboxes) returns true if all the boxes have been revealedotherwise false for in revealedboxes if false in return false return false if any boxes are covered return true the player has won the game when all of the icon pairs have been matched since the --revealed|data structure gets values in it set to true as icons have been matchedwe can simply loop through every space in revealedboxes looking for false value if even one false value is in revealedboxesthen we know there are still unmatched icons on the board note that because revealedboxes is list of liststhe for loop on line will set the inner list as the values of but we can use the in operator to search for false value in the entire inner list this way we don' need to write an additional line of code and have two nested for loops like thisfor in revealedboxesfor in revealedboxes[ ]if false =revealedboxes[ ][ ]return false why bother having main(function if __name__ ='__main__' main(it may seem pointless to have main(functionsince you could just put that code in the global scope at the bottom of the program insteadand the code would run the exact same howeverthere are two good reasons to put them inside of main(function firstthis lets you have local variables whereas otherwise the local variables in the main(function would have to become global variables limiting the number of global variables is good way to keep the code simple and easier to debug (see the --why global variables are evil|section in this