At my current level I can generally figure things out and the code does what it should but it takes a fair amount of trial and error and the result is probably not that good.
If you want to learn math, a good place to start would be AoPS curriculum https://artofproblemsolving.com/store/recommendations
Continue with Susan Rigetti's curriculum https://www.susanrigetti.com/math
You can get answers to your questions here https://www.reddit.com/r/learnmath/ and here https://math.stackexchange.com/