Blockage management for projects
Over the course of learning (i.e. your life) you learn strategies for problem solving. When you encounter a new problem you go through your known strategies to find a solution. If one occurs to you, fine. If it doesn't, perhaps a reasonable modification of one of your strategies will work. But if that doesn't get you home then you need help. So ask. 

But you will do better if you do two things. Don't ask for the answer, but, instead, for insight into how to find the answer. And then, incorporate what you learn into an expanded set of strategies. 

In programming, many of the strategies are well known. Testing, edge cases, etc. In other fields there may also be well known strategies. Quite a lot of education is to expose students to these various ways of looking at problems. 

But in general, it is better to ask than to thrash. And there is no reason why it shouldn't be the teacher he or she may actually be the best person to give you the minimal hint that lets you get yourself over the block. Other people are more likely to just give you an answer that will advance your thinking power much less.