def hanoi(disks, src, temp, dest):
    if disks < 1: 
        return
        
    hanoi(disks - 1, src, dest, temp)
    print(f'move disk from {src} to {dest}')
    hanoi(disks - 1, temp, src, dest) 
    
for i in range(4):
    print(f'using {i} {"disk" if i == 0 else "disks"}')
    hanoi(i, 'A', 'B', 'C')
    print('')

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: