Thread Shed Tasks 11-12

I’ve been working on the "Thread Shed’ project in Learn Python 3. For some reason, when I follow the Codeacademy solution up to Tasks 11-12; each desired list ends up being repeated 4 times per list.
I was wondering if people knew whether this was a problem they have encountered, as I have followed the solution line-by-line.


Do you have code to post to illustrate this?

1 Like

Thanks for your reply!
I don’t know if I’m allowed to paste the code directly here (I’m relatively new to coding here & it’s a PRO course), but I’ve attached the link to the exercise:

I’ve made corrections and written exactly the same thing as Matt in the ‘Get Unstuck’ video, so I wanted to check if this is a bug or not.

I suspect it might be to do with the respective indexation in the final for loop , to get the customers, sales and thread_sold list.

1 Like

Ah there’s always a risk sticking too close to a solution. You do make an interesting observation though, it repeats 4 times. That could be useful debugging information. There are very few places in your code that are designed to repeat. Following that thread a little further, does one of them perhaps repeat 4 times?

Perhaps something is repeating that you don’t want to repeat?

If you can't quite clock the error

This is a pretty common query that trips up a lot of users and a quick search will find you dozens of threads covering this problem.

1 Like

I think if it has repeated for you as well, it’s likely a bug in the exercise (which I’ve already suggested).
It’s unusual because every term in the initial ‘daily sales’ dataset seems to figure 4 times; and I think the only thing that could be linked to that is each transaction contains 4 terms.

Thank you for everybody’s help!

It’s not a bug in the exercise, it’s an issue with the code you’ve written that I’m sure the solution does not have (though the video is very deceptive at the critical point). I’d highly encourage you to hunt down the bug yourself as it’s code you wrote, this is a really important skill for programming.

If you can’t find it after extensive testing then have a search of the forums (magnifying glass icon on the top hover bar) as this step trips up a lot of users and a number of solutions have already been provided.

1 Like

Yeah, I think I’ve found the solution on this post: it’s to do with an earlier task where you have to indent the appendment to transactions_clean correctly. That’s solved the issue!
Link here: Thread Shed Project in Python 3 course

Ah, yep. That’s the step that always produces numerous posts here in the forum.

As long as you get the why of that bit of code and can explain it transactions_clean.append(transaction_clean) has to be outside the inner loop, then you’re all set.

Which is why it’s sometimes useful to debug code whilst talking to a yellow rubber duck. :duck:

1 Like