fork(1) 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. maior = 0
  8. chave_maior = None
  9. for chave, valor in aDict.items():
  10. if len(valor) > maior:
  11. maior = len(valor)
  12. chave_maior = chave
  13.  
  14. return chave_maior
  15.  
  16.  
  17. animals = { 'a': ['aardvark'], 'b': ['baboon'], 'c': ['coati']}
  18.  
  19. animals['d'] = ['donkey']
  20. animals['d'].append('dog')
  21. animals['d'].append('dingo')
  22.  
  23.  
  24. print(biggest(animals))
Success #stdin #stdout 0.04s 9376KB
stdin
Standard input is empty
stdout
d