A total noob here learning Python.
After doing some things, my code starts looking messy and repetitive. Is there a better/cleaner way to handle lots of choices? Or is this normal at the beginning?
14 likes · 12 answers · 6 views
After doing some things, my code starts looking messy and repetitive. Is there a better/cleaner way to handle lots of choices? Or is this normal at the beginning?
14 likes · 12 answers · 6 views
Answers (12)
Totally normal at the beginning, everyone’s code looks messy at first. You’ll naturally start writing cleaner code as you learn.
Very normal. Beginners often repeat code a lot before learning cleaner patterns like loops and functions.
Yep, that’s part of learning. Once you notice repetition, it usually means it’s time to look into functions.
Messy code is honestly a good sign — it means you’re practicing and figuring things out.
Honestly, messy code is part of the process. Even experienced devs rewrite and clean code later.
Repetitive code usually means there’s a smarter structure, but that’s exactly what you learn over time.
If you’re repeating the same lines, try turning that part into a function to reuse it.
Don’t worry, every Python beginner goes through this. Refactoring comes with time.
totally normal, just start using functions, loops, or dictionaries to clean things up as you go
That's a very good signal on the fact that you are learning and accepting that its not good... now just hang on to this feeling, go n prompt AI about it and you'll realize the ways to solve it eventually evolving you from a beginner to master
For sure, look into asking your Agent to write comments in the code as Why it did what it did. That way you look at it and learn more from that.
that's the the first step of learning something