Question: Using Python 3! Thanks! Write a function test alert(thresholds, counts, num_months 2) that takes as input a list of monthly thresholds, a list of monthly
Using Python 3! Thanks!
Write a function test alert(thresholds, counts, num_months 2) that takes as input a list of monthly thresholds, a list of monthly case counts for the year to date, and an optional parameter that specifies the number of consecutive months that the threshold must be exceeded before an alert is triggered. Thresholds refers to the output from calculate_alert levels(aligned_counts). The function should return the month that the alert is triggered, if the threshold has be exceeded for num_months, or -1 if no alert has been triggered so far Assumptions You can assume that the length of counts is always less than the length of thresholds. >>print (thresholds[1]) [6,o, 1.5, 11.6, 34.4, 89.6, 139.2, 81.6, 73.2, 29.4, 11.7, ., >> testalert (thresholds[1], 0,0,4]) >>> test_alert (thresholds [1], [0,10,23,30]) MAR >>> test alert (thresholds [1], [0,10,23,30], num months 3) >>> test alert (thresholds[1], [10,1,5,45,931) MAY Write a function test alert(thresholds, counts, num_months 2) that takes as input a list of monthly thresholds, a list of monthly case counts for the year to date, and an optional parameter that specifies the number of consecutive months that the threshold must be exceeded before an alert is triggered. Thresholds refers to the output from calculate_alert levels(aligned_counts). The function should return the month that the alert is triggered, if the threshold has be exceeded for num_months, or -1 if no alert has been triggered so far Assumptions You can assume that the length of counts is always less than the length of thresholds. >>print (thresholds[1]) [6,o, 1.5, 11.6, 34.4, 89.6, 139.2, 81.6, 73.2, 29.4, 11.7, ., >> testalert (thresholds[1], 0,0,4]) >>> test_alert (thresholds [1], [0,10,23,30]) MAR >>> test alert (thresholds [1], [0,10,23,30], num months 3) >>> test alert (thresholds[1], [10,1,5,45,931) MAY
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
