Deleted 40 lines from my first Python script and it finally ran, copy pasting isn't coding
I spent my first two months learning Python by copying code from tutorials and Stack Overflow answers, and I never really got why anything worked. Then last month I had to build a little script that renames 300 photos from a folder on my laptop, and my first version was a 40 line mess that broke every time it hit a file with a space in the name. I got mad and deleted almost all of it, then wrote maybe 8 lines from scratch with a simple for loop, a print statement for each file, and a try/except after the first run crashed. What actually made it click was adding one print line after every step and running the script over and over to see what the variables held at each point, not reading another tutorial. It took me about 3 hours to finish something a friend said would take 20 minutes, but I understood every single character on the screen by the end. Copy pasting gives you working code for the moment, but typing it out badly and fixing it yourself gives you the skill for good. If you're stuck at the copy paste stage, try rewriting one old script from a blank file with no help and see how far you get before you need to look something up, what usually breaks first for you?