3
answers
0
watching
208
views
8 Sep 2018
Question 8. [6 MARKS] Consider this code: def sort_guesses (guess_list, answer): (list of float, float) -> dict of (str: list of float) Return a new dictionary where each item in guess_list appears as an item in one of the dictionary's values lists: - each item less than answer is in a list associated with key 'low', - each item equal to answer is in a list associated with key 'correct', and - each item greater than answer is in a list associated with key 'high'. If there are no items associated with one of 'low', 'correct', or 'high', then that string should not appear as a key in the new dictionary. In the table below, we have outlined two test cases for sort_guesses. Add six more test cases chosen to test the function thoroughly. R eturn Value Test Case Description no guesses one low guess guess_list answer [ 5.5 [4.7] 6.0 {'low': [4.7]}
Question 8. [6 MARKS] Consider this code: def sort_guesses (guess_list, answer): (list of float, float) -> dict of (str: list of float) Return a new dictionary where each item in guess_list appears as an item in one of the dictionary's values lists: - each item less than answer is in a list associated with key 'low', - each item equal to answer is in a list associated with key 'correct', and - each item greater than answer is in a list associated with key 'high'. If there are no items associated with one of 'low', 'correct', or 'high', then that string should not appear as a key in the new dictionary. In the table below, we have outlined two test cases for sort_guesses. Add six more test cases chosen to test the function thoroughly. R eturn Value Test Case Description no guesses one low guess guess_list answer [ 5.5 [4.7] 6.0 {'low': [4.7]}
29 Jun 2023
Jarrod RobelLv2
11 Sep 2018
Already have an account? Log in