def hanoi(disks, src, dest, temp):
    if disks > 0:
        hanoi(disks - 1, src, temp, dest)
        print(f'move disk from {src} to {dest}')
        hanoi(disks - 1, temp, dest, src)

for i in range(4):
    print(f'using {i} {"disk" if i == 0 else "disks"}')
    hanoi(i, 'A', 'C', 'B')
    print('')

Embed on website

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