Respuesta :
Answer:
def tower_of_hanoi(n , source, auxiliary, destination):
if n==1:
print("Move disk 1 from source",source,"to destination",destination )
else:
tower_of_hanoi(n-1, source, destination, auxiliary)
print("Move disk",n,"from source",source,"to destination",destination )
tower_of_hanoi(n-1, auxiliary, source, destination)
n = 3
tower_of_hanoi(n,'A','B','C')
Explanation:
The python function "tower_of_hanoi" is a recursive function. It uses the formula n - 1 of the n variable of recursively move the disk from the source rod to the destination rod.
Finally, the three disks are mounted properly on the destination rod using the if-else statement in the recursive function.