the parameter dclass of simwalks is of type classand is used in the first line of code to create drunk of the appropriate subclass laterwhen drunk takestep is invoked from field movedrunkthe method from the appropriate subclass is automatically selected the function drunktest also has parameterdclassof type class it is used twiceonce in the call to simwalks and once in the first print statement in the print statementthe built-in class attribute __name__ is used to get string with the name of the class the function drunktest calculates the coefficient of variation of the distance from the origin using the cv function defined in figure def walk(fdnumsteps)"""assumesf fieldd drunk in fand numsteps an int > moves numsteps timesand returns the difference between the final location and the location at the start of the walk ""start getloc(dfor in range(numsteps) movedrunk(dreturn start distfrom( getloc( )def simwalks(numstepsnumtrialsdclass)"""assumes numsteps an int > numtrials an int dclass subclass of drunk simulates numtrials walks of numsteps steps each returns list of the final distances for each trial""homer dclass(origin location( distances [for in range(numtrials) field( adddrunk(homerorigindistances append(walk(fhomernumtrials)return distances def drunktest(walklengthsnumtrialsdclass)"""assumes walklengths sequence of ints > numtrials an int dclass subclass of drunk for each number of steps in walklengthsruns simwalks with numtrials walks and prints results""for numsteps in walklengthsdistances simwalks(numstepsnumtrialsdclassprint dclass __name__'random walk of'numsteps'stepsprint mean ='sum(distances)/len(distances),'cv ='cv(distancesprint max ='max(distances)'min ='min(distancesfigure the drunkard' walk (with bug