DEV Community

Discussion on: Dead Simple Python: Iteration Power Tools

Collapse
 
codemouse92 profile image
Jason C. McDonald • Edited

You could do that. I deliberate used a 1 because I wanted to use 1-based indexing in my output, instead of 0-based. I personally liked it better, that's all.

If you want to start from 0, as in your code, you can actually omit the second argument altogether, and just use enumerate(range(10,101,10)).

Collapse
 
turvey profile image
Marc Turvey

That makes sense, however in order to get the result provided in the post for your first snippet, you would have needed to have put a 0 or omitted the second argument, which is what I found confusing as the second snippet then shows the correct results for using a 1.

Cheers
Marc

Thread Thread
 
codemouse92 profile image
Jason C. McDonald

Oh! Derp, I see it now. Sorry, typo! Fixed.

Thread Thread
 
turvey profile image
Marc Turvey

No worries! Just glad it wasn’t me not getting it.

Keep up the good work, this is a great series!

Cheers
Marc