Urgencias X11916


Statement
 

pdf   zip

html

Un centro de asistencia primaria almacena en una lista las visitas de urgencias realizadas mes a mes en la forma [’enfermedad’, mes, número de casos].

Diseñad la función urgencias(lista) que, dada la lista de urgencias, devuelva un diccionario cuya clave sea la enfermedad y el valor una lista con el número de casos de cada mes (una lista de 12 elementos).

Sample session
>>> lista = [['Gastroenteritis', 8, 17], ['Varicela', 3, 14],
...     ['Gastroenteritis', 4, 15], ['Faringitis', 11, 18],
...     ['Gastroenteritis', 11, 18], ['Varicela', 6, 16],
...     ['Gastroenteritis', 2, 18], ['Varicela', 7, 10],
...     ['Faringitis', 8, 15], ['Gripe', 4, 38],
...     ['Varicela', 12, 6], ['Faringitis', 2, 20],
...     ['Gastroenteritis', 6, 25], ['Gastroenteritis', 5, 14],
...     ['Varicela', 8, 13], ['Faringitis', 12, 18], ['Gripe', 7, 28],
...     ['Gripe', 12, 34], ['Varicela', 2, 13], ['Faringitis', 4, 25],
...     ['Gastroenteritis', 3, 17], ['Gastroenteritis', 7, 20],
...     ['Faringitis', 9, 18], ['Gastroenteritis', 10, 19], ['Gripe', 8, 32],
...     ['Varicela', 11, 19], ['Gripe', 3, 40], ['Faringitis', 6, 22],
...     ['Varicela', 4, 12], ['Gripe', 5, 31], ['Gastroenteritis', 9, 17],
...     ['Varicela', 9, 10], ['Faringitis', 7, 18], ['Gripe', 11, 40],
...     ['Faringitis', 1, 17], ['Faringitis', 5, 12],
...     ['Gastroenteritis', 1, 24], ['Varicela', 1, 2],
...     ['Faringitis', 10, 18], ['Gripe', 9, 46], ['Varicela', 10, 17],
...     ['Gripe', 10, 39], ['Gripe', 2, 35], ['Gripe', 6, 35],
...     ['Gastroenteritis', 12, 9], ['Faringitis', 3, 24], ['Gripe', 1, 20],
...     ['Varicela', 5, 12]]
>>> print(urgencias(lista) ==
...     {'Gastroenteritis': [24, 18, 17, 15, 14, 25, 20, 17, 17, 19, 18, 9],
...     'Gripe': [20, 35, 40, 38, 31, 35, 28, 32, 46, 39, 40, 34],
...     'Varicela': [2, 13, 14, 12, 12, 16, 10, 13, 10, 17, 19, 6],
...     'Faringitis': [17, 20, 24, 25, 12, 22, 18, 15, 18, 18, 18, 18]})
True
Information
Author
Professors Informàtica EEBE
Language
Spanish
Official solutions
Python
User solutions