Implement the Tower of Hanoi Algorithm - last stretch!

Tell us what’s happening:

my string comes out perfectly formatted and in line with the examples, no wrong spaces or anything. what am i doing wrong? when i run hanoi_solver(3) or 4 or 5 it comes out correctly

Your code so far

def hanoi_solver(disks):
    
    first = [x for x in range(disks,0,-1)]
    start = [first,[],[]]
    running = []
    running.append(f'{start[0]} {start[1]} {start[2]}')
    current = start
    
    def move (n,source: int,destination: int, aux: int ):
        if n == 0:
            return
        if n == 1:
            current[destination].append(current[source][-1])
            current[source].remove(n)
            running.append(f'{current[0]} {current[1]} {current[2]}')
            return
        
        move(n-1,source,aux,destination)
        
        current[destination].append(current[source][-1])
        current[source].remove(n)
        running.append(f'{current[0]} {current[1]} {current[2]}')
        
        move(n-1,aux,destination,source)
        return

    move(disks,0,2,1)

    
    new_running = ''
    for x in running:
        x = f'{x}\n'
        new_running +=x
    return new_running

print(hanoi_solver(3))

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36

Challenge Information:

Implement the Tower of Hanoi Algorithm - Implement the Tower of Hanoi Algorithm

GitHub Link: https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/lab-tower-of-hanoi/68773ee26f332a80bc0295db.md

Hi @robkarlson104

Your code contains an extra new character at the end.

Happy coding

There is an extra line break at the end of your output.
You can use join instead.

words = ["Hello", "world"]
result = " ".join(words)
print(result) # Hello world

This is an example.