Looking at the direct question, ‘to learn code in Python?’ we could start with the very basics. Let’s pretend we’re still young and a long ways off learning college maths. One would hope that we have fundamental numeracy skills and can add/subtract, multiply/divide, compute percentages, understand negative numbers and fractions. Those are all covered by the time we get to middle school, and enough to have under our belt when we begin to learn Python (or programming in general).
More important, believe it or not is literacy skills and communication. Learning a language means having to read a lot, learn a mountain of new terms, grapple with syntax and through it all compose notes that we can decipher down the road. Strong communication skills are a definite asset so what we read makes sense. If this is a problem, then deal with it first, not while you are learning.
Python does not do math for us. We do math with Python (or any language) by drawing on basic constructs and as we progress, the built in math functions that come with the language. We won’t be reaching for those functions to begin with, just using the basic operators and learning the algorithms to achieve our goal (like the sum of a list, &c.).
It certainly does not hurt to learn math fundamentals alongside the programming, and a segue into more serious learning may be necessary at some point in time. Having a full set of math skills already won’t make one a better programmer, but it will remove one of the hurdles when it comes to integration of math concepts and programming.
Then there is the other piece of the puzzle… Science in general. It’s through studying nature that we learn the math of the universe, the real relationships that make up the physical world. Math is the language of science, so don’t be afraid to enhance your scientific knowledge on the weekends while you get a break from this learning.