For example if you spend months studying only to fail a course there is no one to blame but you.
In that situation, I think you should retake the course at the first opportunity, and keep retaking it until you pass.
There's a difference between failing and giving up.