Question: IN PYTHON Q7. filterCustomerByKey (customer_list, key): takes as argument the customer_list and a key (either a string for clerk or an integer for minute) to
IN PYTHON
Q7. filterCustomerByKey (customer_list, key): takes as argument the customer_list and a key (either a string for clerk or an integer for minute) to filter the customers. If the key is a string such as A, then only shows the customer served by clerk-A (if clerk not found, print the message Error: clerk- not found.). If the key is an integer number such as 15, then only shows the customer spent more time than that time (if no match, print the message Nothing to show.). Note that filter is only applicable inside this function, this action shouldnt modify the customer_list in-place. Show the filtered list same as the printCustomerInfo format: , served by , spent minutes. Example of function calls: filterCustomerByKey (customer_list, A) filterCustomerByKey (customer_list, 15)
solve in python
Annabel, served by clerk-A, spent 17 minutes. Edgar, served by clerk-B, spent 19 minutes. Felipe, served by clerk-A, spent 10 minutes.
checking unittest... Activity: 1 filterCustomerByKeyO (hwo_96) Result Actual Value Expected Value Notes Fail 'Edgar...tes. In Case 1: key="B" Expand Differences 11 Fail 'Error...und. In Case 2: key="X" Expand Differences Fail 'Error...und. In Case 3: key="100" Expand Differences II Fail 'Nothi...how.In Case 4: key=100 Expand Differences Fail 'Annab. tes. In Case 5: key=9 Expand Differences Pass [['An..., 8]] [l'An..., 8]] Case 6: customer_list unchanged Expand Differences You passed: 16.66666666666666% of the tests Question in Context checking unittest... Activity: 1 filterCustomerByKeyO (hwo_96) Result Actual Value Expected Value Notes Fail 'Edgar...tes. In Case 1: key="B" Expand Differences 11 Fail 'Error...und. In Case 2: key="X" Expand Differences Fail 'Error...und. In Case 3: key="100" Expand Differences II Fail 'Nothi...how.In Case 4: key=100 Expand Differences Fail 'Annab. tes. In Case 5: key=9 Expand Differences Pass [['An..., 8]] [l'An..., 8]] Case 6: customer_list unchanged Expand Differences You passed: 16.66666666666666% of the tests Question in Context
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
