elif value = on [ , , , elif value = on [ , , , , elseon [ , , , , , for in onself pips[isetfill(self foregroundthe version without lists required lines of code to accomplish the same task but we can do even better than this notice that this code still uses the if-elif structure to determine which pips should be turned on the correct list of indexes is determined by valuewe can make this decision table-driven instead the idea is to use list where each item in the list is itself list of pip indexes for examplethe item in position should be the list [ , , ]since these are the pips that must be turned on to show value of here is how table-driven approach can be codedontable [][ ][ , ][ , , ][ , , , ][ , , , , ][ , , , , , for pip in self pipsself pip setfill(self backgroundon ontable[valuefor in onself pips[isetfill(self foregroundi have called the table of pip indexes ontable notice that padded the table by placing an empty list in the first position if value is the dieview will be blank now we have reduced our lines of code to seven in additionthis version is much easier to modifyif you want to change which pips are displayed for various valuesyou simply modify the entries in ontable there is one last issue to address the ontable will remain unchanged throughout the life of any particular dieview rather than (re)creating this table each time new value is displayedit would be better to create the table in the constructor and save it in an instance variable putting the definition of ontable into __init__ yields this nicely completed classdieview py from graphics import class dieview""dieview is widget that displays graphical representation of standard six-sided die "" an even better approach would be to use class variablebut class variables are beyond the scope of the current discussion