A spreadsheet column was exported as a list of strings. Some cells are blank or hold only spaces; every other cell holds a number, possibly with spaces around it (" 12.5 ", "-3").
Write column_summary(cells) that returns a tuple (count, low, high, mean, worst) for the numbers in the non-blank cells:
count: how many numbers there are,lowandhigh: the smallest and the largest number,mean: their mean,worst: the largest distance of any number from the mean.
All four values after count are floats. If there are no numbers, return (0, None, None, None, None).
Examples
Input: cells = [" 4", "", "10", " ", "7.0 ", "-3"]
Output: (4, -3.0, 10.0, 4.5, 7.5)
Explanation: The numbers are 4, 10, 7 and -3. Their mean is 18 / 4 = 4.5; -3 is 7.5 away from it.
Input: cells = ["", " "]
Output: (0, None, None, None, None)
Floats are compared with a tolerance of 1e-6.
Constraints
0 <= len(cells) <= 10**5- Every non-blank cell is a valid number for
floatonce the spaces around it are removed.
Goals
- Clean and convert a list of strings with `map` and `filter` on existing functions
- Summarise numbers with `len`, `sum`, `min`, `max` and `abs` instead of hand-written loops
- Return a sensible result when no values are left