implementing the model so farwe have pretty good picture of what the dice class will do and starting point for implementing the pokerapp class we could proceed by working on either of these classes we won' really be able to try out the pokerapp class until we have diceso let' start with the lower-level dice class implementing dice the dice class implements collection of dicewhich are just changing numbers the obvious representation is to use list of five ints our constructor needs to create list and assign some initial values class dicedef __init__(self)self dice [ ]* self rollall(this code first creates list of five zeroes these need to be set to some random values since we are going to implement rollall function anywaycalling it here saves duplicating that code we need methods to roll selected dice and also to roll all of the dice since the latter is special case of the formerlet' turn our attention to the roll functionwhich rolls subset we can specify which dice to roll by passing list of indexes for exampleroll([ , , ]would roll the dice in positions and of the dice list we just need loop that goes through the parameter and generates new random value for each listed position def roll(selfwhich)for pos in whichself dice[posrandrange( , nextwe can use roll to implement rollall as followsdef rollall(self)self roll(range( ) used range( to generate sequence of all the indexes the values function is used to return the values of the dice so that they can be displayed another one-liner suffices def values(self)return self dice[:notice that created copy of the dice list by slicing it that wayif dice client modifies the list that it gets back from valuesit will not affect the original copy stored in the dice object this defensive programming prevents other parts of the code from accidentally messing with our object