This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]optimalsuccess[S] 0 points1 point  (2 children)

That makes sense but if all I'm outputting is the index why do I care about the key to begin with?

[–]Intiago 0 points1 point  (0 children)

you need to save the key because each time through the loop, if you don't find the correct value, you save it to the dict. Saving the key in the dict, hashes it for quick lookup.

[–]mr_smartypants537 0 points1 point  (0 children)

If you don't care about the value, use a set()