A total noob here learning Python.

Asked (@mautheng) ·

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?

Answers (12)

  1. Maxim Build · · 2 likes

    Totally normal at the beginning, everyone’s code looks messy at first. You’ll naturally start writing cleaner code as you learn.

  2. Emily · · 2 likes

    Very normal. Beginners often repeat code a lot before learning cleaner patterns like loops and functions.

  3. Zainab · · 1 like

    Yep, that’s part of learning. Once you notice repetition, it usually means it’s time to look into functions.

  4. Joshua · · 1 like

    Messy code is honestly a good sign — it means you’re practicing and figuring things out.

  5. The devquee · · 1 like

    Honestly, messy code is part of the process. Even experienced devs rewrite and clean code later.

  6. Idhika · · 1 like

    Repetitive code usually means there’s a smarter structure, but that’s exactly what you learn over time.

  7. Shreya · · 1 like

    If you’re repeating the same lines, try turning that part into a function to reuse it.

  8. Mandel · · 1 like

    Don’t worry, every Python beginner goes through this. Refactoring comes with time.

  9. Vision · · 1 like

    totally normal, just start using functions, loops, or dictionaries to clean things up as you go

  10. Ayush · · 1 like

    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

  11. mousedevv ·

    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.

  12. Hadi ·

    that's the the first step of learning something

14 likes · 12 answers · 6 views

Explore more on Prompted