Something I just learned the hard way /u/CMDR_Pumpkin_Muffin Python Education

Do NOT modify the list you are iterating through. Make a second list and apply changes to it instead. I spent 4 hours trying to understand why sometimes my code works and sometimes it doesn’t. I felt equally stupid and smart when I finally got it. At least I doubt I’ll quickly forget that lesson.

submitted by /u/CMDR_Pumpkin_Muffin
[link] [comments]

​r/learnpython Do NOT modify the list you are iterating through. Make a second list and apply changes to it instead. I spent 4 hours trying to understand why sometimes my code works and sometimes it doesn’t. I felt equally stupid and smart when I finally got it. At least I doubt I’ll quickly forget that lesson. submitted by /u/CMDR_Pumpkin_Muffin [link] [comments] 

Do NOT modify the list you are iterating through. Make a second list and apply changes to it instead. I spent 4 hours trying to understand why sometimes my code works and sometimes it doesn’t. I felt equally stupid and smart when I finally got it. At least I doubt I’ll quickly forget that lesson.

submitted by /u/CMDR_Pumpkin_Muffin
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *