💡
11

Finally got my first Python script to run without errors after three days of trying

I was stuck trying to decide if I should keep fixing my messy code or just start over from scratch. I picked starting over and wrote it again from the beginning yesterday. I used a simple list of 10 city names to test it this time. It worked on the first try and I felt so good. Has anyone else found that rewriting a project helps it finally click?
4 comments

Log in to join the discussion

Log In
4 Comments
cora518
cora51812d ago
Rewriting always helps me too (like @hill.margaret said), so what was your script supposed to do?
9
daniel140
daniel14012d ago
Absolutely, rewriting is the only way my brain works sometimes. I had a script that was supposed to rename a bunch of files based on their dates, but my first try was a complete mess of loops. Scrapped it, wrote it again just to handle two files, and built it out from there. That second version actually made sense.
4
charles_mitchell
Read somewhere that scrapping the first draft is a common programmer trick. Makes sense if the first try is just figuring out the problem.
3
hill.margaret
Totally get that. I rewrote a data scraper three times before it made sense. Starting fresh with a smaller test case is always my move now. What were you trying to make?
7