Conditioning on body temperature
Let's say you were tasked with programming a diagnostic tool that assesses a patient's body temperature. You want to print warnings if the temperature is too high or too low and a reassuring message if it is just right. In this exercise, you'll write a conditional expression to aid the diagnosis.
The float body_temp, which is the body temperature in degrees Celsius, is available in your environment.
이 연습은 강의의 일부입니다
Introduction to Julia
연습 안내
- Print the message
"Seems a little cold"ifbody_tempis less than 35.9. - Print the message
"Might be a fever"ifbody_tempis more than 37.6. - Print the message
"The patient's temperature seems normal"otherwise.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Print a warning message if the temperature is too low
____
println("Seems a little cold")
# Print a warning message if the temperature is too high
____
println("Might be a fever")
# Print the message if the temperature is normal
____
println("The patient's temperature seems normal")
# Finish the conditional block
____
println("temperature = $body_temp")