Re: [Tutor] Understanding error in recursive function

2016-04-08 Thread Alan Gauld
On 09/04/16 00:34, Martin A. Brown wrote: > You start by creating a dictionary that uses an initial letter as > the key and a list to hold the names of the animals. Your function > could probably be as simple as: > > def howMany(aList): > return len(aList) > > Here is an inefficien

Re: [Tutor] Understanding error in recursive function

2016-04-08 Thread Alan Gauld
On 08/04/16 21:48, Tom Maher wrote: > As a test I am trying to write a function that returns the sum of values > attached to one key in a dictionary. I am wondering why the code that I > wrote is returning: > "maximum recursion depth exceeded " Python has a limit to how many times you can recursi

Re: [Tutor] Understanding error in recursive function

2016-04-08 Thread Martin A. Brown
Greetings Tom, >As a test I am trying to write a function that returns the sum of >values Given the code you pasted, I think you mean 'count' of values, right? I'll assume that below, because it is a tricky thing to sum some strings. >attached to one key in a dictionary. I am wondering why

Re: [Tutor] Understanding error in recursive function

2016-04-08 Thread Danny Yoo
On Fri, Apr 8, 2016 at 1:48 PM, Tom Maher wrote: > Hi, > > As a test I am trying to write a function that returns the sum of values > attached to one key in a dictionary. Why does the program try to use recursion for this problem? ___ Tutor maillist -

[Tutor] Understanding error in recursive function

2016-04-08 Thread Tom Maher
Hi, As a test I am trying to write a function that returns the sum of values attached to one key in a dictionary. I am wondering why the code that I wrote is returning: "maximum recursion depth exceeded " Here is the code: animals = { 'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']} x = anima

Re: [Tutor] Tutor Digest, Vol 146, Issue 9

2016-04-08 Thread Alan Gauld
On 08/04/16 17:44, Jason Willis wrote: > there are hard-coded content dependant entries. I solved this by changing > all instances of the word "elite" and changing them to "standard" and the > program works! Glad you got it working. > I agree with you that taking a few hours to learn python > w

Re: [Tutor] Tutor Digest, Vol 146, Issue 9

2016-04-08 Thread Jason Willis
My apologies for the word wrap. It seemed to look ok in my web client (gmail). Thank you for the pointer to other instances in the program where there are hard-coded content dependant entries. I solved this by changing all instances of the word "elite" and changing them to "standard" and the progra