เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Operating on body temperatures

You have been asked to analyze an array of body temperature data for a sample of people. Abnormally high or low body temperatures might indicate that person is unwell.

The array of measurements is available in your environment as body_temps_f, but these are the body temperatures measured in degrees Fahrenheit. You would prefer to work with these values in Celsius.

Thankfully, you know that you can convert these temperatures in Julia using array operations.

You can convert a measurement \(T_f\) measured in Fahrenheit into the equivalent temperature in Celsius using:

Equation to convert Fahrenheit to Celsius

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Introduction to Julia

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Subtract 32 from each element of the body_temps_f array and assign it to a new variable named body_temps_sub.
  • Multiply each element of body_temps_sub by a factor of 5/9 and assign it to the variable body_temps_c.
  • Sort body_temps_c from lowest to highest and assign the result to sorted_body_temps_c.
  • Print the five lowest values from sorted_body_temps_c.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Subtract 32 from each element of body_temps_f
body_temps_sub = ____

# Multiply each element in body_temps_sub by 5/9
body_temps_c = ____

# Sort the temperatures from lowest to highest
sorted_body_temps_c = ____(____)

# Print the 5 lowest temperatures
println(____)
แก้ไขและรันโค้ด