I'm going to say something that's a little tough but it's meant as advice coming from years of mistakes before I finally got my head on the right way: Part of growing up is learning to prioritize what you need to do, even if it isn't fun, over what you like to do. This is how the real world works, and it's what you'll spend the rest of your life doing. Learning to do it when you're young, when mistakes are smaller, w…
I can spend hours and days programming incredibly boring, repetitive code, because the end result is valuable. Teaching your brain to understand this is the struggle the OP faces.
BTW especially with maths, teachers mostly fail at providing any context above 'learn this rule, so you can apply a slightly more advanced version of it next year'. There is a huge amount of context and thought around the mathematics that's being taught, but little effort ever goes into expounding it. If you're struggling with maths in particular, try reading up on some of the history of the topics to find out why they were invented, and what problems they solve. It brings an incredibly richness to what can be a fairly dry, abstract subject.