+ 1
The given array represents the daily number of infections for 30 days. The condition and output the size of the resulting array.
import numpy as np data = np.array([120, 98, 150, 65, 42, 100, 190, 220, 140, 110, 88, 89, 100, 120, 50, 180, 155, 42, 89, 77, 200, 190, 125, 98, 77, 40, 39, 59, 30, 67]) mean = np.mean(data) counter = 0 for i in data: if i>mean: counter+1 print(counter) What's wrong with my code?
3 Antworten
+ 6
Arya Swastik Kar
the counter will not be properly incremented currently, so it keeps the initial value of *0*.
> you can use: counter += 1
+ 9
Arya Swastik Kar
> what is your question ?
> can you please mention the tutorial name, also the exercise number / name
> we would also like to see your approach. please link your code here.