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
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to