fork download
  1. def biggest(aDict):
  2. '''
  3. aDict: A dictionary, where all the values are lists.
  4.  
  5. returns: The key with the largest number of values associated with it
  6. '''
  7.  
  8. return max(aDict, key=lambda x: len(aDict[x]))
  9.  
  10. animals = { 'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']}
  11.  
  12. animals['d'] = ['donkey']
  13. animals['d'].append('dog')
  14. animals['d'].append('dingo')
  15.  
  16. print(biggest(animals))
Success #stdin #stdout 0.04s 9404KB
stdin
Standard input is empty
stdout
d