List printing 4 times?

I really don’t get what I am doing wrong.
On this part of the assignment I am told to iterate through an existing list and strip the whitespaces.

I have done just that, however, when printing the new list which I’ve appended the new elements to, it keeps printing everything in 4’s (attached photo).
I even went and followed the video guide, word for word, and it still ends up the same.
Any help would be appriciated.

Check for appends that take place inside the same (inner) loop.

I see what you mean, the second append was inside the inner loop and I guess that caused it to print multiple times.
Now that it’s on the outer loop it works, thank you.

1 Like