Nobody is born with wisdom – especially when it comes to computers. It takes experience to build core understanding. Sometimes people try to cheat this process and simply ask for the solution to a problem they encounter. This is okay in some contexts, but for the most part, more can be gained by grinding through the problem yourself.
Now, I’m not trying to say that you should never ask a question. A quick question and answer can help save you from wasting your time, but be careful what usage of your time is classified as “waste”. For this, I’ll pose an example:
You’ve never worked with regular expressions, but want to check an input string for a complex pattern. Your buddy is a regex guru and could whip up an expression in two shakes of a lamb’s tail. Would you…
a) Have your buddy quickly write the expression for you.
b) Ask your buddy to write the expression and explain it to you.
c) Take the time to learn enough about regular expressions to do it yourself.
There’s not a right answer. If you’re running short on time and need the expression to move on with the project, maybe a is the right answer. If you want to get the gist of what this thing you’re adding to your code is, but don’t really want to go in depth, maybe b is the right answer. Finally, if you have the time and want to actually understand what the regular expression is and exactly what it’s doing in your code, maybe c is the right answer.