ComeçarComece de graça

Using the Statistics package

Now that you know how to import and use packages, you can analyze the data from the last chapter even further.

The array body_temps_c, which you created in the last chapter, is available in the environment. This array contains some measurements of body temperatures in degrees Celsius.

Another array named heart_rates is also available in your environment and contains the heart rates of the same sample of people measured in beats per minute.

You want to find the average value of each of these arrays. You know that inside the Statistics package, there is a function called mean(), which will calculate exactly what you want.

Este exercício faz parte do curso

Introduction to Julia

Ver curso

Instruções do exercício

  • Import the Statistics package under the name sts.
  • Use the mean() function from the Statistics package to find the mean of body_temps_c.
  • Print the mean body temperature.
  • Use the mean() function from the Statistics package to find the mean of heart_rates.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Import the Statistics package
____

# Calculate the mean body temperature
mean_body_temp_c = ____(____)

# Print the mean body temperature
println("The mean body temperature is ", ____)

# Calculate the mean heart rate
mean_heart_rate = ____(____)

println("The mean heart rate is $mean_heart_rate")
Editar e executar o código