On 08/04/2016 21:48, 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. 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 = animals['a'] def howMany(aDict): count = 0 for value in howMany(aDict): count += 1 return count howMany(x) Just wondering why I would be getting that error. Thanks
howMany calls howMany which calls howMany... -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence _______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
