[Tutor] Sorting the parts of a dictionary into a list

Jacob Bender benderjacob44 at gmail.com
Sun May 6 15:02:47 CEST 2012


Dear tutors,

I'm trying to create a neural network program. Each neuron is in a
dictionary and each of its connections and their strengths are in a nested
dictionary. So {0:{1:4, 2:5}}, 1:{0:6}, 2:{1:2}} would mean that neuron 0
is connected to neuron 1 with a strength of 4. And it also means that
neuron 1 is connected to neuron 0 with a strength of 6.

The problem is that I'm working on a function that is supposed to add the
total strengths of each neuron. So, for example, neuron 0's connections
have a total strength of 9 (4+5). The other problem is getting all of the
total strengths and ordering the neurons into a list. So, from the example,
the list would be from [0,1,2] because zero has the greatest total strength
of 9, then 1 with a total strength of 6 and so on. I've been working on
this problem for at least 2 hours now and still haven't found anything
close to a solution.

Thank you and please help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120506/1d5d6724/attachment.html>


More information about the Tutor mailing list