I need a mood for programming, is this normal?

Whenever I have to solve problems, I need a mood. I can’t solve problems when I see them, I need to have a mood to solve them. Is this normal. The mood comes once a week or so. It comes when my mind is stress free and I’m tired of doing other stuffs but relaxed.

Yep. That is totally normal. It’s like any other mentally taxing activity. You need to be in the right headspace for it. For me, listening to classical music in the background helps.