Just found out I was using a for loop for stuff a dictionary does way better
I was building a little script for my kid's baseball team to track who showed up to practice and who didn't. Nothing fancy, just a text file and Python. I had this big ugly for loop that went through the roster list every single time I wanted to check if a kid was there, like 30 lines of nested ifs. Then my cousin who works at a help desk in Boise looked at it over the weekend and said, why not just use a dictionary and check the key? I felt so dumb because it cut the whole thing down to about 6 lines and my script went from taking 4 seconds to run to instant. What got me was that I had already learned dictionaries two chapters back but I just kept going back to loops because they felt safe. Now I'm going through my other old practice scripts and finding the same mistake all over. Did anyone else get stuck using one tool for everything when you first started learning? And how long did it take before the right one actually popped into your head first?