Data analysis X27316


Statement
 

pdf   zip

html

Design the function analisis(data, limite) which, given a list of lists data and an int limite, returns a dictionary that classifies as ’OK’ the number of lists in data whose length is equal to or less than limite and as ’KO’ how many exceed it.

Sample session
#Lista vacía
>>> a = analisis([], 3)
>>> if a != {'OK': 0, 'KO': 0}: print(a)

#OK simple
>>> a = analisis([[1, 1]], 2)
>>> if a != {'OK': 1, 'KO': 0}: print(a)

#KO simple
>>> a = analisis([[1, 1]], 1)
>>> if a != {'OK': 0, 'KO': 1}: print(a)

#OK Multiple
>>> a = analisis([[1, 1], [2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4, 4]], 10)
>>> if a != {'OK': 4, 'KO': 0}: print(a)

#Mix
>>> a = analisis([[1, 1], [2], [3, 3, 3, 3, 3], [4, 4, 4, 4, 4, 4]], 2)
>>> if a != {'OK': 2, 'KO': 2}: print(a)
Information
Author
InfBesos
Language
English
Translator
Original language
Spanish
Other languages
Catalan Spanish
Official solutions
Python
User solutions
Python