Discuss Scratch

LiLJonJon94
New Scratcher
2 posts

How to make an average of numbers from a list?

Hi, I would like to know how I could make an average using the numbers from a list. Like, if my list has 10 numbers as items and they were 1-10 scratch would be able to give me an average visually from those numbers. Thank you in advance!
LiLJonJon94
New Scratcher
2 posts

How to make an average of numbers from a list?

More specifically, when I press the A key the average will show up
scubajerry
Scratcher
1000+ posts

How to make an average of numbers from a list?

when [a v] key pressed
set [sum v] to (0)
set [i v] to (1)
repeat (length of [your list v])
change [sum v] by (item (i) of [your list v])
change [i v] by (1)
end
set [average v] to <(sum) / (length of [your list v]

Last edited by scubajerry (Nov. 11, 2013 05:15:34)

Aberox
Scratcher
1 post

How to make an average of numbers from a list?

scubajerry wrote:

when [a v] key pressed
set [sum v] to (0)
set [i v] to (1)
repeat (length of [your list v])
change [sum v] by (item (i) of [your list v])
change [i v] by (1)
end
set [average v] to <(sum) / (length of [your list v]
Thank you so much!
GuyLikeMe
New Scratcher
2 posts

How to make an average of numbers from a list?

thats too much work im too laZY
deck26
Scratcher
1000+ posts

How to make an average of numbers from a list?

GuyLikeMe wrote:

thats too much work im too laZY
You can't do it then.

Powered by DjangoBB