Question 10 Not complete Marked out of 6.00 Flag question Write a function high_low_dict (numbers, sep) that takes a lis
Posted: Fri Jun 10, 2022 11:55 am
Question 10 Not complete Marked out of 6.00 Flag question Write a function high_low_dict (numbers, sep) that takes a list of numbers and an int sep that will return a dictionary of keys "highs" and "lows", where the values are sorted lists of unique numbers determined by sep, where "high" and "low" numbers will fall on either side of the sep value. For example: numbers = [1, 1, 2, 3, 4, 4, 5] . sep = 3 Returns: {"lows": [3, 4, 5], "highs": [1, 2, 3]} The sep value will be included in both highs and lows lists if present. Note: sep is guaranteed to lie within the range min(numbers) - max(numbers) For example: Test Result print (high_low_dict ( [1,2,2,3,4,5,5,6,7,7,8], 5)) {'lows': [1, 2, 3, 4, 5], 'highs': [5, 6, 7, 8]} print (high_low_dict([5,2,4,1,1,3,5,8,9], 6)) {'lows': [1, 2, 3, 4, 5], 'highs': [8, 9]} Answer: (penalty regime: 0, 10, ... %) 1 def high_low_dict(numbers, sep): 2 """Returns a dictionary of keys "highs" and "lows".""" 3