argmax([ , , , , , , ] def argmaxd(dct)"""returns the arx max of dictionary dct""return argmaxe(dct items()tryarxmaxd({ : , : , : }exercise change argmax to have an optional argument that specifies whether you want the "first""lastor "randomindex of the maximum value returned if you want the first or the lastyou don' need to keep list of the maximum elements probability for many of the simulationswe want to make variable true with some probability flip(preturns true with probability pand otherwise returns false utilities py -(continued def flip(prob)"""return true with probability prob""return random random(prob dictionary union this is now in python so will be replaced the function dict union( returns the union of dictionaries and if the values for the keys conflictthe values in are used this is similar to dict( )but that only works when the keys of are strings utilities py -(continued def dict_union( , )"""returns dictionary that contains the keys of and the value for each key that is in is the value from otherwise it is the value from this does not have side effects "" dict( copy update( return testing code it is important to test code early and test it often we include simple form of unit test the value of the current module is in __name__ and if the module is run at the top-levelit' value is "__main__see librarymain html version june