Jan-20-2019, 09:03 AM
Hint: You can use colltections.defaultdict, to append the values to the dict. There is also an example.
Instead of iterating with one loop, you can do a nested loop.
On the top level iterating over this list -> you get dicts
In the second level you iterate over dict.items(), which gives you key, value of the whole dict back.
There is more than one way. I have chosen the way, which needs only 3 lines of understandable code.
Instead of iterating with one loop, you can do a nested loop.
On the top level iterating over this list -> you get dicts
In the second level you iterate over dict.items(), which gives you key, value of the whole dict back.
There is more than one way. I have chosen the way, which needs only 3 lines of understandable code.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!