CommencerCommencer gratuitement

Condition selon la température corporelle

Imaginons que vous deviez programmer un outil de diagnostic qui évalue la température corporelle d’un patient. Vous souhaitez afficher des alertes si la température est trop élevée ou trop basse, et un message rassurant si elle est correcte. Dans cet exercice, vous allez écrire une expression conditionnelle pour faciliter le diagnostic.

Le flottant body_temp, qui correspond à la température corporelle en degrés Celsius, est disponible dans votre environnement.

Cet exercice fait partie du cours

Introduction à Julia

Afficher le cours

Instructions

  • Affichez le message "Seems a little cold" si body_temp est inférieur à 35.9.
  • Affichez le message "Might be a fever" si body_temp est supérieur à 37.6.
  • Affichez le message "The patient's temperature seems normal" sinon.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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")
Modifier et exécuter le code