random start exercise (optionali chose to have the ball start motionlessby making the initial value of pt (which determines the initial (dxdybe the center of the ball write variation startrandom py so pt is randomly chosen also make the initial location of the ball be random you can copy the function getrandompoint from bounce py mad lib while exercise *write program madlib py that modifies the getkeys method of madlib py to use while loop (this is not an animation programbut this section is where you have had the most experience with while loops!hintsthis is actually the most natural approach avoided while loops initiallywhen only for loops had been discussed in the original approachhoweverit is redundant to find every instance of '{to count the number of repetitions and then find them all again when extracting the cue keys more natural way to control the loop is while loop stopping when there are no further occurrences of '{to find this involves some further adjustments you must cut the loop in different place (to end after searching for '{'as discussed beforecutting loop in different place may require changes before and after the looptoo find hole game exercise *write graphical game programfindhole py"find the holethe program should use random number generator to determine circular "hole"selecting point and perhaps the radius around that point these determine the target and are not revealed to the player initially the user is then prompted to click around on the screen to "find the hidden holeyou should show the points the user has tried once the user selects point that is within the chosen radius of the mystery pointthe mystery circle should appear there should be message announcing how many steps it tookand the game should end hintyou have already seen the code to determine the displacement (dxdybetween two pointsuse the getshift function in bounce py once you have the displacement (dxdybetween the hidden center and the latest mouse clickthe distance between the points is (dx*dx dy*dy)** using the pythagorean theorem of geometry if this distance is no more than the radius that you have chosen for the mystery circlethen the user has found the circleyou can use getshift as writtenor modify it into function getdistance that directly returns the distance between two points many elaborations on this game are possiblehave fun with itfancier animation loop logic (optionalthe final variation is the example program bounce pywhich has the same outward behavior as bounce pybut it illustrates different internal design decision the bounce py version has two levels of while loop in two methodsmoveinbox for mouse clicks and bounceinbox for bouncing the bounce py version puts all the code for changing direction inside the main animation loop in the old outer functionmoveinbox there are now three reasons to adjust (dxdy)bouncing off the sidesbouncing off the top or bottomor mouse click that is simplification and unification of the logic in one sense the complication now is that the logic for determining when to quit is buried deep inside the if-else logicnot at the heading of the loop the test for mouse clicks is inside the while loop and further inside another if statement the test of the mouse click may merely lead to change in (dxdy)or is signal to quit here is the revised codewith discussion afterward of the return statementdef moveinbox(shapestopheightxlowxhighylowyhighwin)''animate shape moving toward any mouse click below stopheight and bouncing when its center reaches the low or high or coordinates the animation stops when the mouse is clicked at stopheight or above ''scale while statements