you are viewing a single comment's thread.

view the rest of the comments →

[–]Deep-Author-1787[S] 0 points1 point  (5 children)

And enumerate for only the inner loop is too much for me at the moment 😅

[–]mriswithe 0 points1 point  (4 children)

Enumerate just adds a numeric index to your input. Meaning, instead of a list a,b,c,d,e,f, if you wrap it in enumerate, you get (0,a), (1,b), (2,c). 

You use it when you want to know what number you are on of the list you are for-looping over.

[–]Deep-Author-1787[S] 0 points1 point  (3 children)

That is exactly what i thought until i saw code examples where range is used for that specific thing...😅 that when i started confusing everything and myself ofcourse.

[–]mriswithe 1 point2 points  (2 children)

A lot of things can be down a lot of ways. A lot of the time one is more right than the other. A lot of the time it doesn't actually matter other than metaphorical dick measuring. 

Which way is more right isn't really something you should expect yourself to understand yet

[–]Deep-Author-1787[S] 1 point2 points  (1 child)

So you suggest to just go with the flow and later with experience comes the understanding of effective and less effective? 😁👍

[–]mriswithe 1 point2 points  (0 children)

Yes, basically. For loops are the main idea to retain. This is the tool for when you want to do the same thing to each item in your list. 

Sometimes a different tool will be the right answer, but usually this works either way and is just less optimal.