python – Tower of Hanoi recursive problem


I wrote this Tower of Hanoi recursive code and I was trying to implement a section that would tell me the minimum number of plays necessary and which play we were on (for example (if there were 3 disks): First move: Tower 1 –> Tower 2 (….etc….) Mininum number of plays: 7). How would i recursively implement it? What about itterativelly? Should I mix recursion with iteration in this case?

def hanoi():

    def mova(n, origem, destino, aux):
        
        def mova_disco(de, para):
            print("Tower", de, "-->", "Tower", para, "nn")


        if n == 1:
            mova_disco(origem, destino)

        else:
            mova(n - 1, origem, aux, destino)
            mova_disco(origem, destino)
            mova(n - 1, aux, destino, origem)

    n = eval(input("Quantos discos deseja considerar? n -->"))
    print("Solução do puzzle: n")
    mova(n, "1", "3", "2")

#Running the code

hanoi()