T
3

Hit a snag with Python loops as a new coder

I started learning Python recently. Nested loops keep tripping me up no matter how many tutorials I watch. What's a good trick to make them click?
2 comments

Log in to join the discussion

Log In
2 Comments
cora_jenkins
Barbara's drawing trick never worked for my brain type.
7
barbara864
Draw each loop on paper to see the layers. I used to just stare at code, but sketching it out fixed my confusion. Label your counters and follow one full inner loop per outer step. That visual trick turns abstract nesting into something you can really follow.
6