Nested loop in Thread Shed

I suspect I know exactly where your error is, but can’t really tell b/c the code isn’t formatted.
Going forward, please format your code b/c Python relies on indentation (as you found out b/c of your code error).

Another thing you might want to do is consult this guide before posting as well as search the forums b/c this is a duplicate question.

Tips on debugging your code…

  • don’t be afraid to break your code in order to understand what it’s exactly doing. Learning how to read code error messages is also a skill.

  • did you try moving the indentation around on your for loops (specifically the nested for loop) and then re-running the code? What happens? Do the duplicates disappear?

  • Also, slightly, but not really off topic: it’s a known issue (by CC) that the video that accompanies this project is flawed; in that it’s difficult to tell where they’ve indented the code that they write. So, the video that’s supposed to help learners really doesn’t…which results in many people having the same code errors as evidenced in the posts here in the forums.

It has to do with this:

Summary

This part:
transactions_clean.append(transaction_clean)
needs to be at the outside level of the inner for loop or else you’ll get dupes b/c it’s cleaning, appending, and appending again.

1 Like