Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I have this exact problem. Can you or someone give a hint how to resolve it?
For anyone else coming across this: Utilize parentheses. I hope this isn't too spoilery...
//bad indentation
Hi.
What is the point in creating new variable avg? You could just
return sum / array.length;
Regards
Its not recalculating the average on each iteration. In this case, for doesnt has any braces
so is executing the first line only. This solution has "stetic" problems with tabs but is correct.
The code is misaligned and "for" doesn't have braces. Yes, from first look the solution doesn't seem to be valid.
Is this best practice? This recalculates the average on each iteration but we only need the final average.