Re: [Tutor] Sorting the Parts of a Dictionary into a List

2012-05-11 Thread Steven D'Aprano
Jacob Bender wrote: The total function works when it returns the strength of a neuron, but I don't think the "sorted" function is the best because, with its current configuration, it returns a type error. I have been doing python for several years now. I don't know EVERYTHING there is to know, b

Re: [Tutor] Sorting the Parts of a Dictionary into a List

2012-05-08 Thread Brian van den Broek
On 8 May 2012 23:23, Jacob Bender wrote: > Dear Tutors, > > My original email was this: > > "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:

Re: [Tutor] Sorting the Parts of a Dictionary into a List

2012-05-08 Thread Dave Angel
On 05/08/2012 05:23 PM, Jacob Bender wrote: > > > > def smartest(self): #Return the neurons in order from smartest to > dumbest in list form. > for neuron in self.neurons: > sorted(neuron, key=self.total(neuron)) > > The total function works when it returns the strength of

[Tutor] Sorting the Parts of a Dictionary into a List

2012-05-08 Thread Jacob Bender
Dear Tutors, My original email was this: "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

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

2012-05-06 Thread Peter Otten
Jacob Bender wrote: > 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 stre

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

2012-05-06 Thread Jacob Bender
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