Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using python 3, Thanks! my_list=[[0 , 1, 4, 17, 67, 76, 51, 28, 3, 1, 0, 0],[0,

ID: 3586659 • Letter: U

Question

Using python 3, Thanks!

my_list=[[0 , 1, 4, 17, 67, 76, 51, 28, 3, 1, 0, 0],[0, 1, 8, 28, 69, 129 , 83, 55, 19, 4, 0, 0],[0, 0, 0, 0, 8, 86, 55, 0, 0, 0, 0, 0],[0, 1, 10, 24, 43, 64, 58, 58, 26, 12, 0, 0],[0, 0, 2, 15, 56, 116 , 51, 8, 0, 0, 0, 0]]

These number in these 5 list mean how many people get involved in 12 months for 5 years.

The output I want is:

[0.0, 1.5010036070959982, 11.622289205244819, 34.49426722133471, 89.63607385581618, 139.22614718138783, 81.65772642409004, 73.2977318948931, 29.497021322298473, 11.755563715273794, 0.0, 0.0]

>>> import statistics >>> x = [2,3,5,3,4] >>> m = statistics.me a n (x) >>> sd = statistics.stdev (x) >>> print(m) 4 >>> print (sd) 1.140175425099138

Explanation / Answer

alertthreshold.py:

#!/usr/bin/python3

import statistics

my_list=[[0 , 1, 4, 17, 67, 76, 51, 28, 3, 1, 0, 0],[0, 1, 8, 28, 69, 129 , 83, 55, 19, 4, 0, 0],[0, 0, 0, 0, 8, 86, 55, 0, 0, 0, 0, 0],[0, 1, 10, 24, 43, 64, 58, 58, 26, 12, 0, 0],[0, 0, 2, 15, 56, 116 , 51, 8, 0, 0, 0, 0]];

list_len=len(my_list);
alert_threshold=[];

for i in range(12):
month_list=[] #fetch the month value for 5 years present in the list
for j in range(list_len):
month_list.append(my_list[j][i]); #here we are appending the month value from each sub-list in my_list

mean=statistics.mean(month_list);
sd=statistics.stdev(month_list);
alertT=mean+1.645*sd;
alert_threshold.append(alertT);

print(alert_threshold);
  
Explanation:  

In the outer for loop i'm interating over every month starting from 1 to 12. In the inner for loop i'm appending the month value for 5 years into month_list.

output:

$ python3 alertthreshold.py
[0.0, 1.5010036070959982, 11.622289205244819, 34.49426722133471, 89.63607385581618, 139.22614718138783, 81.65772642409004, 73.2977318948931, 29.497021322298473, 11.755563715273794, 0.0, 0.0]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote