0

# Hey some one solve this for me.

We have a report on the number of flu vaccinations in a class of 20 people. It has the following numbers: never: 5 once: 8 twice: 4 3 times: 3 What is the mean number of times those people have been vaccinated? Output the result using the print() statement

13th Mar 2021, 3:04 PM
Philip
17 odpowiedzi
+ 5
This should help. You probably know how to gather the numbers from input so I didn't do that. never = 5 once = 8 twice = 4 three_times = 3 def get_mean(never, once, twice, three_times): count = never + once + twice + three_times total = 0 * never + 1 * once + 2 * twice + 3 * three_times return total / count print(get_mean(never, once, twice, three_times))
13th Mar 2021, 3:39 PM
Josh Greig
+ 5
vac_nums = [0,0,0,0,0, 1,1,1,1,1,1,1,1, 2,2,2,2, 3,3,3 ] never = vac_nums.count(0) once = vac_nums.count(1) twice= vac_nums.count(2) three_times = vac_nums.count(3) mean = (never*0 + once*1 + twice*2 + three_times*3)/len(vac_nums) print(mean)
27th Jan 2022, 11:47 AM
Damir Prlja
+ 1
#your code goes here #Write Your Dataset In This Format ds=[0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3] #Initialized your sum variable sum=0 #Traverse through the dataset and add each data in the dataset to the sum variable for i in ds: sum+=i #Divide the sum variable value by 20 and output the value print(sum/20)
25th May 2021, 3:25 PM
Maxwell D. Dorliea
+ 1
@Mubeen Yasin is actually correct.
8th Jul 2021, 8:05 PM
Small Dog from "2 Stupid Dogs"
+ 1
nums={0:5,1:8,2:4,3:3} total = 0 count = 0 for key,val in nums.items(): count += val total += (key * val) print(total/count)
6th Aug 2021, 2:05 PM
Awang Praja Anugerah
0
Hi! You tried to do this?
13th Mar 2021, 3:27 PM
Yaroslav Vernigora
0
Please tag programming language. Supposedly you want python. You already finished 3 python courses, so you should be able to do this. At least show an attempt
13th Mar 2021, 3:30 PM
Benjamin Jürgens
0
I think numpy has a mean function built in. So assign it to a list and put numpy.mean(x)
13th Mar 2021, 9:51 PM
Andrew Johnson
0
try to analyze the data and hint first dt = [0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3] from : never: 5 once: 8 twice: 4 3 times: 3 this is my code, I think this is the simplest way to solve this: dt = [0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,3,3,3] dt_sum = sum(dt) result = dt_sum/(len(dt)) print(result)
30th Aug 2021, 3:29 PM
Supalerk Prawanna
0
#CODE HERE x=5+8+4+3 y=(0*5)+(1*8)+(2*4)+(3*3) print(y/x) #ENJOY 😃😃😃
3rd Sep 2021, 2:29 PM
sachin Dubey
0
mean = sum(vac_nums[5:]) / len(vac_nums) print(mean)
3rd Dec 2021, 2:06 PM
Joshua Hans C. Aringino
0
sum=0; for i in range(len(vac_nums)): sum=sum+vac_nums[i] print(sum/len(vac_nums))
23rd Feb 2022, 6:33 PM
Hari Prasaanth
0
mean= sum(vac_nums)/len(vac_nums) print(mean);
21st Jul 2022, 6:20 AM
Devi Levina
0
vac_nums = [0,0,0,0,0, 1,1,1,1,1,1,1,1, 2,2,2,2, 3,3,3 ] #your code goes here total=0 for item in vac_nums: total+=item average=total/len(vac_nums) print(average)
16th Nov 2022, 4:00 PM
0
vac_nums = [0,0,0,0,0, 1,1,1,1,1,1,1,1, 2,2,2,2, 3,3,3 ] #your code goes here print(sum(vac_nums)/len(vac_nums))
29th Nov 2022, 3:59 PM
Ronalds Skulme
- 1
Not got the answer I did the same thing
24th Mar 2021, 6:01 PM
ankit goyal
- 2
print(25/20)
31st Mar 2021, 3:41 AM
Mubeen Yasin
Popularne dzisiaj
XP farming