step shuffling and truncating the list of all icons random shuffle(iconsrandomize the order of the icons list numiconsused int(boardwidth boardheight calculate how many icons are needed icons icons[:numiconsused make two of each random shuffle(iconsbut rememberthere may be more possible combinations than spaces on the board we need to calculate the number of spaces on the board by multiplying boardwidth by boardheight then we divide that number by because we will have pairs of icons on board with spaceswe' only need different iconssince there will be two of each icon this number will be stored in numiconsused line uses list slicing to grab the first numiconsused number of icons in the list (if you've forgotten how list slicing workscheck out on line so it won' always be the same icons each game then this list is replicated by using the operator so that there are two of each of the icons this new doubled up list will overwrite the old list in the icons variable since the first half of this new list is identical to the last halfwe call the shuffle(method again to randomly mix up the order of the icons step placing the icons on the board create the board data structurewith randomly placed icons board [for in range(boardwidth)column [for in range(boardheight)column append(icons[ ]del icons[ remove the icons as we assign them board append(columnreturn board now we need to create list of lists data structure for the board we can do this with nested for loops just like the generaterevealedboxesdata(function did for each column on the boardwe will create list of randomly selected icons as we add icons to the columnon line we will then delete them from the front of the icons list on line this wayas the icons list gets shorter and shortericons[ will have different icon to add to the columns to picture this bettertype the following code into the interactive shell notice how the del statement changes the mylist list mylist ['cat''dog''mouse''lizard'