+ 1
number of vacciens (phyton)
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. Hint: Think about the data this way: it contains 20 values, each representing the number of vaccinations the corresponding person had.
6 Antworten
+ 2
A.K.-GAMERZ __YT
Is your problem with the syntax of the code, the logic of the challenge, or the math required?
Please attach your attempt, or further details about your problem because it looks like you want someone to solve this for you.
But I am sure that is not so! 😉
+ 2
complete the python for beginner course first
+ 2
do you need an explanation ?
+ 1
data={"never":5,"once":8,"twice":4,"3 times":3}
total=0
count=0
for key,value in data.items():
if key=="never":
continue
else:
count+=1
total+=data[key]
mean=total/count
print("Mean : {}".format(mean))
+ 1
Jasy Fabiano
Great code buddy, but a learner will not learn anything from it without an explanation.
Some people will just copy/paste and take credit from your efforts.
+ 1
Yes