def hanoi(n, source, target, spare): """Move n disks from source to target, using spare as working space.""" if n == 0: return hanoi(n - 1, source, spare, target) print(f"Move disk {n} from {source} to {target}") hanoi(n - 1, spare, target, source) if __name__ == "__main__": hanoi(3, "A", "C", "B")