0

Can you help me with the Python code for calculating arithmetical mean (sum of numbers in the range/ number of numbers)

https://code.sololearn.com/cXQZfTnH30t4/?ref=app

18th Mar 2020, 12:43 AM
Felix
4 ответов
+ 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
18th Mar 2020, 12:52 AM
Arsenic
Arsenic - avatar
+ 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
18th Mar 2020, 6:19 AM
Arsenic
Arsenic - avatar
+ 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?
18th Mar 2020, 4:32 AM
Felix
+ 1
Arsenic, thanks a lot!
18th Mar 2020, 6:29 AM
Felix