0
Can you help me with the Python code for calculating arithmetical mean (sum of numbers in the range/ number of numbers)
4 Respuestas
+ 3
Mean is (sum of terms/number of terms).
- you are adding the terms but not dividing them from number of terms
Here you go👇
https://code.sololearn.com/cpyRGA9749FK/?ref=app
+ 2
Феликс in that case just check weather the term is divisible by 3 or not(using modulo"%") operator and do the operation only when it is needed
Like this👇
https://code.sololearn.com/c26adN5yLgw2/?ref=app
+ 1
Great 👍🏻 Thanks. And how can I update it if the terms can only be devided by 3 (for example, in range(-5,6) there'd be only 4 terms: -3, 0, 3, 6 and s then should be 1,5?
+ 1
Arsenic, thanks a lot!