T
10

Had a talk with a high school kid about loops that totally changed my approach

I was helping out at a local coding club last Tuesday and this 16 year old kid asked me why I kept writing the same code block three times instead of just using a loop. I started explaining about readability and edge cases but he just pulled up his phone and showed me this 20 line project he built using recursive functions. That hit different because I realized I'd been avoiding loops for years out of fear of messing up the syntax. Now I practice loops for 10 minutes a day on a little Python sandbox and it's actually making my code way cleaner. Has anyone else had a moment where a beginner showed you something obvious you were missing?
2 comments

Log in to join the discussion

Log In
2 Comments
grace_knight70
@wrenh65 has a point, I bet that kid would take one look at my messy recipe bookmarks folder and rewrite the whole thing. I had a similar moment last year when a college intern showed me how to use list comprehension in Python, I had been writing these dumb for loops for months. It stings a little when someone half your age spots a blind spot, but it's also the best way to learn.
7
wrenh65
wrenh6517d ago
Dude that kid would lose his mind if he saw how I write my grocery lists.
3