V
3

The one thing every rookie does with if statements that drives me nuts

I spent 3 hours last night helping a buddy debug his Python script and it was just nested ifs inside nested ifs inside more ifs. He had 8 levels of indentation for something that could have been 4 elif statements and a dictionary lookup. Why do so many tutorials teach if/else chains instead of showing beginners how to flatten logic with proper data structures?
0 comments

Log in to join the discussion

Log In
0 Comments

No comments yet

Be the first to share your thoughts on this discussion.