thedotmaster wrote:I disagree.
Firstly that example was just a simple one, a better example would be something where multiple variables are used only once and a new variable is assigned
For give me, but that's exactly why we have different codes to do different things. I made the "for loop" for your simple example. I've never said I would apply it to everything. Same reason why we have ifs/ternary, and switches.
I am however still quite new at python though, if it'd be possible for you to explain why you'd prefer your code over mine with the first example as reference. I did a benchmarking on it, the for loop ran faster than the while loop. It's 3 lines less as well. Can you please explain? thanks