Discuss Scratch
- Discussion Forums
- » Suggestions
- » List Statistics
- reallysoftuser
-
1000+ posts
List Statistics
This would use the numbers in a List to get the average, sum, or other statistics.
[mean v] of [my list v] :: operatorsIt wouldn't count list entries that have alphabetical letters or symbols.
[median v] of [my list v] :: operators
[min v] of [my list v] :: operators
[max v] of [my list v] :: operators
[sum v] of [my list v] :: operators
Last edited by reallysoftuser (April 20, 2022 22:38:49)
New Itch Cat game! It's a good one.
Oh snap!
New updates for Windows 11 coming soon, including tabs for File Explorer, contextual suggestions across Microsoft 365 apps, Cloud PC integration, a redesigned Quick Assist, App folders for the Start Menu, oh my!
Microsoft is preparing a new email client for Windows 11!
![](https://assets.scratch.mit.edu/get_image/.%2E/ea7b9cc1a3434c6c7b377626002228e5.jpg)
In the latest Windows 11 update, Microsoft is going to give a new look to its classic Outlook email app and make it more user friendly and feature rich like Google Gmail email app.
- TheAnimalKingdom42
-
1000+ posts
List Statistics
Even though all of those have a workaround, this would be very useful because it is much less complicated. However, does it have to be an extension? Could these just be additional list blocks?
![](https://uploads.scratch.mit.edu/get_image/project/719698335_2480x520.png)
- reallysoftuser
-
1000+ posts
List Statistics
Bumped, second paged.
New Itch Cat game! It's a good one.
Oh snap!
New updates for Windows 11 coming soon, including tabs for File Explorer, contextual suggestions across Microsoft 365 apps, Cloud PC integration, a redesigned Quick Assist, App folders for the Start Menu, oh my!
Microsoft is preparing a new email client for Windows 11!
![](https://assets.scratch.mit.edu/get_image/.%2E/ea7b9cc1a3434c6c7b377626002228e5.jpg)
In the latest Windows 11 update, Microsoft is going to give a new look to its classic Outlook email app and make it more user friendly and feature rich like Google Gmail email app.
- jackson49
-
1000+ posts
List Statistics
Good idea, but I think it should be a list block, not an operator
Be moist
![](http://cdn.scratch.mit.edu/scratchr2/static/__9c6d3f90ec5f8ace6d3e8ea1e684b778__/djangobb_forum/img/smilies/cool.png)
PC LOAD LETTER
;
- Geotale
-
100+ posts
List Statistics
Though I don't support this, I'll add that Scratch's number conversion would already handle the case where non-numbers are included
Anyways, as for why I don't support this – Every single thing in here is incredibly simple to implement otherwise. The sum of a list? It's not difficult to add up everything in a list – Adding up everything in a list and dividing it by the list length isn't either.
The only one that isn't trivial to implement is median, but when is median actually used?
Anyways, as for why I don't support this – Every single thing in here is incredibly simple to implement otherwise. The sum of a list? It's not difficult to add up everything in a list – Adding up everything in a list and dividing it by the list length isn't either.
The only one that isn't trivial to implement is median, but when is median actually used?
- RL1123
-
1000+ posts
List Statistics
Sounds cool, but all of these have a somewhat simple workaround:
This median's a bit more difficult:
Now to get the median from the sorted list:
The main problem I see with these blocks isn't the fact that they're too easy or hard to create, it's that they're hardly ever used. Projects hardly ever use mean and median on lists unless it's some niche project, which is few and far between. For now, I think it would be better if people would create their own code instead of the developers making built-ins to do it for them. Or they can borrow code from other projects, there are many excellent projects out there that have working code on mean, median, sum, min, and max.
[sum v] of [my list v] :: operatorsSum and mean are very similar, so the workaround can be combined.
[mean v] of [my list v] :: operators
set [index v] to [1]
set [sum v] to [0]
repeat (length of [my list v] :: list)
change [sum v] by (item (index) of [list v] :: list)
change [index v] by (1)
end
set [mean v] to ((sum) / (length of [my list v] :: list))
[min v] of [my list v] :: operatorsMin and max are also close to the same exact script.
set [index v] to [1]
set [min v] to (item (1 v) of [my list v] :: list)
repeat (length of [my list v] :: list)
if <(item (i) of [my list v] :: list) < (min)> then
set [min v] to (item (index) of [ mylist v] :: list)
end
change [index v] by (1)
end
[max v] of [my list v] :: operators
set [index v] to [1]
set [max v] to (item (1 v) of [my list v] :: list)
repeat (length of [my list v] :: list)
if <(item (i) of [my list v] :: list) > (max)> then
set [max v] to (item (index) of [ mylist v] :: list)
end
change [index v] by (1)
end
This median's a bit more difficult:
[median v] of [my list v] :: operatorsThis chunk of code sorts or puts the list in ascending order so that we can find the number(s) in the middle. I'm aware that there are faster ways to get the median than sorting and there are much faster sorting algorithms, but I'm lazy.
delete (all v) of [sorted v]
set [index1 v] to [1]
repeat (length of [my list v] :: list)
set [item2 v] to [1]
repeat until <<(item (index1) of [my list v] :: list) < (item (index2) of [sorted v] :: list)> or <(item2) > (length of [sorted v] :: list)>>
change [item2 v] by (1)
end
insert (item (item1) of [my list v] :: list) at (item2) of [sorted v]
change [item1 v] by (1)
end
![](http://cdn.scratch.mit.edu/scratchr2/static/__9209616f20ac7fc52efa806cd216a370__/djangobb_forum/img/smilies/hmm.png)
if <((length of [sorted v] :: list) mod (2)) = [1]> then // If the list has an odd number of elements, get the number from the middle of the list.
set [median v] to (item ([floor v] of ((length of [sorted v] :: list) / (2))) of [sorted v] :: list)
else // we average the two center elements
set [median v] to (((item ([floor v] of ((length of [sorted v] :: list) / (2))) of [sorted v] :: list) + (item ([ceiling v] of ((length of [sorted v] :: list) / (2))) of [sorted v] :: list)) / (2))
end
The main problem I see with these blocks isn't the fact that they're too easy or hard to create, it's that they're hardly ever used. Projects hardly ever use mean and median on lists unless it's some niche project, which is few and far between. For now, I think it would be better if people would create their own code instead of the developers making built-ins to do it for them. Or they can borrow code from other projects, there are many excellent projects out there that have working code on mean, median, sum, min, and max.
![](https://assets.scratch.mit.edu/get_image/.%2E/c82a899522903b3f1374b3899f0a862e.gif)
through tough thorough thought, though
Signature #11
- doodleblues
-
100+ posts
List Statistics
serious support
Workarounds for theres are extremely inefficient and complicated (i wouldnt even bother trying to use rrl1123's workaround haha Way too complicated) and have these blocks will be a lot easier !!!
If somebody were to apply them to an alphabetical list what would happen ?
Workarounds for theres are extremely inefficient and complicated (i wouldnt even bother trying to use rrl1123's workaround haha Way too complicated) and have these blocks will be a lot easier !!!
If somebody were to apply them to an alphabetical list what would happen ?
- k0d3rrr
-
1000+ posts
List Statistics
What if someone doesn't want to do these specifically for lists? What if they just want to do maths for other things and not lists only?
Also, is this a duplicate? Just wondering: https://scratch.mit.edu/discuss/topic/307629/
Even though it does suggest more features, it also suggests the same things that this suggestion does. (Both suggestions suggest mean, median, and sum. Probably also min and max.)
Also, is this a duplicate? Just wondering: https://scratch.mit.edu/discuss/topic/307629/
Even though it does suggest more features, it also suggests the same things that this suggestion does. (Both suggestions suggest mean, median, and sum. Probably also min and max.)
Last edited by k0d3rrr (April 21, 2022 05:15:35)
- mbrick2
-
1000+ posts
List Statistics
https://scratch.mit.edu/discuss/topic/307629/Without a doubt. Also, is this a duplicate? Just wondering:
Its suggesting for Mean, Median, Mode, Range, Sum, Product, Biggest, Smallest, Biggest, Least Lettered, Most Lettered. Upper Quartile, Lower Quartile, Interquartile Range and this is Mean, Sum, Median, Min (smallest) and Max (biggest) so that post is just a bigger version if this one.
![](https://assets.scratch.mit.edu/get_image/.%2E/0a71e1c6c769a93256ed680e6a5971e2.png)
![](https://assets.scratch.mit.edu/get_image/.%2E/2d163063911b10e230f4d89f850051b3.png)
![](https://u.cubeupload.com/t3ch3r/ezgif41dc6f594d208.gif)
![](https://assets.scratch.mit.edu/get_image/.%2E/2e39f81e11c9f348b1a1d92f1e14a144.png)
My Forums
ATs
Collabaration
My collabs
AIPoint
AspectOS
CoreOS
OddyseyOS
Cops and Robbers
#BringBackManagerRights
#ReturnRightsToManagers
#WeAreForManagerRights
#LetsRemindAboutMangers
#WeAreMangers
#MangersMustManage
The road to 1000 posts!
0 ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ ▒ 1000
80% complete
![](https://assets.scratch.mit.edu/get_image/.%2E/90e2720673d4d78a9c85cfdc6ba9abc4.png)
Banner Made By @Abcde26
Card Made By @Polygon
![](https://assets.scratch.mit.edu/get_image/.%2E/41b583a65fabbcb76d37f2e4006fb880.png)
Card Made By @Polygon
- Discussion Forums
- » Suggestions
-
» List Statistics