I believe that when you're trying to learn the basics, these blocks happen all the time where you have made a mistake and the answer is difficult to find. While many experienced programmers say that this skill of finding solutions is valuable, I think there is a balance to be struck.
When I start to feel annoyed, which in turn saps my enthusiasm, I move to another course/program that I am trying to get through. Often you will come back to the problem with fresh eyes and possibly have learnt something elsewhere that helps you solve it.
Having a few good free courses in each language has allowed me to keep going happily, which for me is the most important thing. The trick is to not beat yourself up and feel like you have given up, but simply bookmark the problem, and move on.