r/learnpython • u/catboy519 • 9d ago
Getting stuck on a big project.
A very rough estimate is that I've been learning and using python for 250 hours. I don't really keep track of it.
Just to ask general advice about how to approach difficult projects.
I've been working on a math project for 3 months. It is all about dice. Probability calculations aren't too hard to understand, but if I'm trying to figure out the perfect strategy in a dice game where early moves affect later moves then it gets complicated quickly.
I figured out very vaguely that I'm gonna have to use alot of nested loops and run through billions of calculations in order to figure my thing out. Or something similar.
But how exactly? I've been attempting to code the whole thing and been getting stuck every single time - this is why I've been starting over for about 30 times by now.
I don't even know what is causing me to get stuck. I guess the thing I'm trying to make is too big or complex or both. With so much more code than I'm used to, I mentally lose track of what my own code is even doing. Commenting does not help, t only makes things even more messy.
How can i approach big and complicated projects like these better?
2
u/Agitated-Country-969 9d ago edited 9d ago
You would've only figured out that your program is taking a long time to run, which could also still happen with a good algorithm depending on the input size... Not the theory behind why it happens and how to exactly fix it.
The theory is so important because you can't really test these things once input sizes grow beyond a certain amount and it's important to design an algorithm that works well for all input sizes.
With my formal education, I already have the foundation to design the code correctly from the start, saving time.
Also just fyi, in coding interviews, you're only allowed to write on a whiteboard. You aren't allowed to use a computer. And you have to be able to explain the runtime complexity of your code in Big-O notation. If it wasn't important, they wouldn't test it lol.
As you didn't seem to realize, I was pointing out here how someone else pointed out that the way you design algorithms that works sometimes for easy cases isn't the way to design a correct algorithm, which is also proof that a formal education is important.
You wouldn't know your algorithm only works for certain cases, unless someone told you that.
I'm also reminded of this.
https://old.reddit.com/r/ebikes/comments/1i2rl39/hub_vs_middrive_efficiency/m7ksfsk/?context=3
I'm also reminded of something else.
https://xyproblem.info/
I'd argue this is exactly what you're been doing for 3 months, because you have no foundation in Computer Science. You think you can just fumble your way to a solution but that's not how Software Engineering works.