Getting stuck on the problems is the best part. That feeling when I solve a frustrating problem is one of the top 3 feelings I've ever felt in my life
That's what programming is at its core. It's simply coming up with a solution to a problem. You have to rewire the way you think to be a good dev.
You also have to be committed though and like
@Cereal_Bowl_Assassin said, you have to be willing to play the game and lose multiple times. But each time you lose, it gets you closer and closer to the winning solution.