The more complex code is, the longer it takes to understand and debug. If it is poorly written code, a multiplier is added to the time required to read it. I have worked with my students to build a "must do before asking questions" list in computer science.
1. Google your question
2. Re-read your code (or function). It can be helpful to read this backwards
3. Use debugging tools
4. Ask the person next to you
5. Read error messages!
6. If you have to ask a teacher for help, make sure you ask a very specific question about a very specific topic
Great questions get great answers. Bad questions get, well, not-great answers.