Skip to content

Commit 1b3205b

Browse files
committed
Updated previous commit.
1 parent 78a4f00 commit 1b3205b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
fun main(args: Array<String>) {
22
val array = arrayOf(50, 60, 70, 70, 100)
3-
val variance = array.run { map { it * it }.average() - average() * average() }
3+
val mean = array.run { sum() / count().toDouble() }
4+
val variance = array.run { map { it * it }.run { sum() / count().toDouble() } - mean * mean }
45
println(variance)
56
}

0 commit comments

Comments
 (0)