Math problems

Hey I know it's been a while, and I don't know if I'm just being dumb or this is actually a problem, but I recieved this issue after making an average block:

Average result

Average block code

Obviously, if you understand math, this should output 2. Any ideas?

Ah, a simple fix solved my problem. Just had to store the input's length and then use it at the end of the script.

Solved it myself, no other solution needed!

To calculate the average, you can just do
untitled script pic (11)

The issue you were having has to do with this

but to fix it, just set "list 2" to

untitled script pic (6)

Just for a bit of fun, below is a (very Snappy!) recursive version:

The delete block deleted items from the list, so the length decreased.

Oh god... I have a feeling this will break... I'll try it anyways.

… and you could even use it with the recursive version of LENGTH OF (data) from Fixing Unordered combinations custom block - #45 by kinestheticlearning (while fixing the deliberate error within the base case, of course) :wink: Even though this would not be very inefficient.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.