News for hackers. Stuff that matters.
Re:Googling for answers costs you time by newaccount74 on Monday July 03, 2023 @03:17AM (#36569811)
The index was on page 2 on the authors screen, you probably have a bigger screen.

But even if you click the link in the index, then you still need to scroll down two to three pages to get to the actual answer:

    for key in a_dict:
         print(key, '->', a_dict[key])
I don't know about you, but I think that an article title "How to Iterate Through a Dictionary in Python" should maybe start with that snippet, instead of first explaining over 9 pages:

- "What dictionaries are, as well as some of their main features and implementation details"

- "How to iterate through a dictionary in Python by using the basic tools the language offers"

- "What kind of real-world tasks you can perform by iterating through a dictionary in Python"

- "How to use some more advanced techniques and strategies to iterate through a dictionary in Python"

Yes, if you spend 30 minutes reading the article, you will know how to iterate over dictionaries afterwards. But if you asked a human being, they would just say "for key in dict:".

There are no comments on this comment yet.