PSA: nested for loops versus a single dictionary pass cut my beginner project from 40 minutes to 6
I built a dumb little script that checks usernames for duplicates in a CSV of about 90,000 rows. My first version had a loop inside a loop, so it compared every name to every other name, and it ran for roughly 40 minutes on my laptop before I killed it. A guy in a Discord server for new coders pointed out I was doing the same work over and over for no reason. I rewrote it to add each name to a dictionary once and flag it when it showed up a second time. Same file, 6 minutes, and most of that was just reading the CSV. The funny part is I spent way more time learning this pattern than it would ever save me on this one file. But now I catch myself spotting double loops in code I wrote months ago. Is there another beginner pattern like this that feels obvious once you see it?