and then move the tower of four from peg two to peg three but what if you do not know how to move tower of height foursuppose that you knew how to move tower of height three to peg threethen it would be easy to move the fourth disk to peg two and move the three from peg three on top of it but what if you do not know how to move tower of threehow about moving tower of two disks to peg two and then moving the third disk to peg threeand then moving the tower of height two on top of itbut what if you still do not know how to do thissurely you would agree that moving single disk to peg three is easy enoughtrivial you might even say this sounds like base case in the making here is high-level outline of how to move tower from the starting poleto the goal poleusing an intermediate pole move tower of height- to an intermediate poleusing the final pole move the remaining disk to the final pole move the tower of height- from the intermediate pole to the final pole using the original pole as long as we always obey the rule that the larger disks remain on the bottom of the stackwe can use the three steps above recursivelytreating any larger disks as though they were not even there the only thing missing from the outline above is the identification of base case the simplest tower of hanoi problem is tower of one disk in this casewe need move only single disk to its final destination tower of one disk will be our base case in additionthe steps outlined above move us toward the base case by reducing the height of the tower in steps and def move_tower(heightfrom_poleto_polewith_pole)if height > move_tower(height from_polewith_poleto_polemove_disk(from_poleto_polemove_tower(height with_poleto_polefrom_polenotice this code is almost identical to the english description the key to the simplicity of the algorithm is that we make two different recursive callsone on line and second on line on line we move all but the bottom disk on the initial tower to an intermediate pole the next line simply moves the bottom disk to its final resting place then on line we move the tower from the intermediate pole to the top of the largest disk the base case is detected when the tower height is in this case there is nothing to doso the movetower function simply returns the important thing to remember about handling the base case this way is that simply returning from movetower is what finally allows the movedisk function to be called the function movediskshown belowis very simple all it does is print out that it is moving disk from one pole to another if you type in and run the movetower program you can see that it gives you very efficient solution to the puzzle def move_disk(fp,tp)print("moving disk from",fp,"to",tpthe following program provides the entire solution for three disks recursion