Question 10 Not complete Marked out of 6.00 Flag question Write a function high_low_dict (numbers, sep) that takes a lis

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
correctanswer
Posts: 43759
Joined: Sat Aug 07, 2021 7:38 am

Question 10 Not complete Marked out of 6.00 Flag question Write a function high_low_dict (numbers, sep) that takes a lis

Post by correctanswer »

Question 10 Not Complete Marked Out Of 6 00 Flag Question Write A Function High Low Dict Numbers Sep That Takes A Lis 1
Question 10 Not Complete Marked Out Of 6 00 Flag Question Write A Function High Low Dict Numbers Sep That Takes A Lis 1 (94.88 KiB) Viewed 76 times
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
Register for solutions, replies, and use board search function. Answer Happy Forum is an archive of questions covering all technical subjects across the Internet.
Post Reply