Double Array Range and Sum String
Geoffrey Challen // 2023.8.0
Let's compute a few summary statistics on a dataset.
Create a method named summarizeValues
that accepts a non-empty DoubleArray
.
Compute the mean and the range of the dataset and return a String
in the following format:
Where <mean>
and <range>
are the mean and range of the dataset computed by your method.
Round the values to 2 decimal points using a method round
which accepts a Double
value.
For example, round(3.33542)
would return 3.34
.
Given the array {1.0, 2.0, 4.0}
, your method should return:
(Note that Kotlin's multi-line string literal will not work correctly for this problem, so you'll need to insert the newline manually.)