How Can I Improve My First Python Program?
Asked by
CuriousCoder99
Hey everyone! I'm revisiting my first Python program and would love some feedback. I'm looking for pointers on how to improve my code and ultimately get a job in IT. I've included a link to my code in the comments since it wasn't working well initially.
Also, I'd appreciate it if you could let me know if my comments in the code are sufficient and if the program aligns with any common coding standards, like rule 6.
Answers
You're off to a great start! I recommend focusing on using more functions in your code; they'll help make your code more organized and reusable. Also, think about using dictionaries instead of those large lists you have. For example, you could structure your nouns and verbs with dictionaries, which will simplify your logic and reduce the number of if statements. Just remember to handle your file operations with context managers, too! Itโll make your code cleaner and avoid some potential bugs.
Reply to this answer
Wait, you didn't start with a 'Hello World' program? The world is crying in a corner somewhere! Just kidding! Seriously though, for a first program, you did good. Your top comments explaining things are neat! Just make sure to keep the explanations close to your code for better readabilityโit's something I often forget myself!
Reply to this answer
This is solid for a first attempt! The comments you've included are helpful, but just be careful with clarity. You might want to consider having them in a separate text file for easier access and just a brief explanation in your code instead. Overall, great job on taking the first step into programming! Keep at it!
Reply to this answer
Add your answer
Answers are reviewed before publication.
CuriousCoder99: Thanks for the feedback! I donโt know much about functions yet, so I'll look that up. How far would I need to go to reach a working level? Should I explore beyond Python or stick with it for now?