Recadrer les mesures d'un tableau⚓︎

Lorsqu'on utilise une sonde pour obtenir des mesures, par exemple des températures, il se peut que des mesures soient trop petites ou trop grandes. On modifie alors ces mesures pour qu'elles ne sortent pas de l'intervalle défini à l'avance.

On donne un tableau de réels mesures et deux réels val_min et val_max. On garantit que val_min est inférieur à val_max.

Compléter le code de la fonction recadre qui :

  • prend en paramètres un tableau de nombres mesures et les nombres val_min et val_max ,
  • modifie le tableau mesures de sorte que :
    • tous les éléments de mesures qui sont strictement inférieurs à val_min sont remplacés par val_min,
    • tous les éléments de mesures qui sont strictement supérieurs à val_max sont remplacés par val_max.

Cette fonction modifie en place le tableau mesures et ne renvoie rien.

Exemples
>>> mesures_1 = [1, 2, 3, 4, 5, 6]
>>> recadre(mesures_1, 3, 5)
>>> mesures_1
[3, 3, 3, 4, 5, 5]
>>> mesures_2 = [7.1, -9.0, -3.1, 15.0, 987.7, -624.89]
>>> recadre(mesures_2, -5.3, 15.0)
>>> mesures_2
[7.1, -5.3, -3.1, 15.0, 15.0, -5.3]
###(Dés-)Active le code après la ligne # Tests (insensible à la casse)
(Ctrl+I)
Tronquer ou non le feedback dans les terminaux (sortie standard & stacktrace / relancer le code pour appliquer)
Évaluations restantes : 5/5
43908.43996.43997.43980.43993.43985.43988.43979.43928.43995.43988.43993.43979.43979.43909.43930.43980.43985.43976.43930.43910.43954.43908.43979.43981.43989.43989.43993.43978.43969.43910.44011.43991.43988.43981.43980.43985.43991.43990.43928.43934.43993.43989.43976.43907.43928.44010.43997.43989.43993.43978.43977.43981.43997.43979.43908.43927.43979.43981.43989.43989.43993.43978.43969.43910.43954.43908.43996.43985.43982.43928.43989.43993.43978.43987.43996.43991.43983.43990.43909.43930.43913.43930.43928.43979.43980.43969.43988.43997.43909.43930.43989.43993.43978.43999.43985.43990.43906.43913.43926.43919.43997.43989.43928.43913.43997.43989.43930.43928.43910.43954.43908.43996.43985.43982.43928.43995.43988.43993.43979.43979.43909.43930.43984.43985.43999.43984.43988.43985.43999.43984.43980.43930.43910.43908.43980.43993.43994.43988.43997.43928.43995.43988.43993.43979.43979.43909.43930.43984.43985.43999.43984.43988.43985.43999.43984.43980.43980.43993.43994.43988.43997.43930.43910.43908.43980.43978.43910.43908.43980.43984.43928.43995.43991.43988.43979.43976.43993.43990.43909.43930.43914.43930.43928.43995.43988.43993.43979.43979.43909.43930.43998.43985.43988.43997.43990.43993.43989.43997.43930.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43998.43985.43988.43997.43990.43993.43989.43997.43930.43910.90037.43928.44008.43978.43991.43976.43991.43979.43985.43980.43985.43991.43990.43928.43996.43997.43928.43995.43991.43978.43978.43997.43995.43980.43985.43991.43990.43908.43927.43979.43976.43993.43990.43910.43908.43927.43980.43984.43910.43908.43927.43980.43978.43910.43908.43980.43978.43910.43908.43980.43996.43928.43995.43988.43993.43979.43979.43909.43930.43988.43985.43990.43997.43990.43991.43979.43930.43910.43908.43996.43985.43982.43928.43995.43988.43993.43979.43979.43909.43930.43988.43985.43990.43997.43990.43991.43996.43985.43982.43930.43910.43908.43976.43978.43997.43910.43908.43979.43976.43993.43990.43910.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43991.43978.43989.43993.43988.43930.43910.43913.43908.43927.43979.43976.43993.43990.43910.43954.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43991.43978.43989.43993.43988.43930.43910.43914.43908.43927.43979.43976.43993.43990.43910.43954.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43991.43978.43989.43993.43988.43930.43910.43915.43908.43927.43979.43976.43993.43990.43910.43954.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43991.43978.43989.43993.43988.43930.43910.43916.43908.43927.43979.43976.43993.43990.43910.43954.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43991.43978.43989.43993.43988.43930.43910.43917.43908.43927.43979.43976.43993.43990.43910.43954.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43991.43978.43989.43993.43988.43930.43910.43918.43908.43927.43979.43976.43993.43990.43910.43908.43927.43976.43978.43997.43910.43908.43927.43996.43985.43982.43910.43908.43927.43980.43996.43910.43908.43980.43996.43928.43995.43988.43993.43979.43979.43909.43930.43995.43991.43996.43997.43930.43910.43908.43996.43985.43982.43910.43908.43976.43978.43997.43910.43908.43979.43976.43993.43990.43910.43908.43927.43979.43976.43993.43990.43910.43908.43995.43991.43996.43997.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43987.43930.43910.43996.43997.43998.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43998.43930.43910.43978.43997.43995.43993.43996.43978.43997.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43920.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43924.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43982.43993.43988.44007.43989.43985.43990.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43924.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43982.43993.43988.44007.43989.43993.43968.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43921.43906.43908.43927.43979.43976.43993.43990.43910.43954.43928.43928.43928.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43987.43930.43910.43998.43991.43978.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43985.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43991.43983.43930.43910.43985.43990.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43994.43930.43910.43978.43993.43990.43999.43997.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43920.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43994.43930.43910.43988.43997.43990.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43920.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43921.43921.43906.43908.43927.43979.43976.43993.43990.43910.43954.43928.43928.43928.43928.43928.43928.43928.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43987.43930.43910.43985.43998.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44003.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43985.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44005.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43991.43930.43910.43934.43988.43980.43907.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43982.43993.43988.44007.43989.43985.43990.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43906.43908.43927.43979.43976.43993.43990.43910.43954.43928.43928.43928.43928.43928.43928.43928.43928.43928.43928.43928.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44003.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43985.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44005.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43991.43930.43910.43909.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43982.43993.43988.44007.43989.43985.43990.43908.43927.43979.43976.43993.43990.43910.43954.43928.43928.43928.43928.43928.43928.43928.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43987.43930.43910.43997.43988.43985.43998.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44003.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43985.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44005.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43991.43930.43910.43934.43999.43980.43907.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43982.43993.43988.44007.43989.43993.43968.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.43906.43908.43927.43979.43976.43993.43990.43910.43954.43928.43928.43928.43928.43928.43928.43928.43928.43928.43928.43928.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44003.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43985.43908.43927.43979.43976.43993.43990.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43976.43930.43910.44005.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43991.43930.43910.43909.43908.43927.43979.43976.43993.43990.43910.43928.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43990.43930.43910.43982.43993.43988.44007.43989.43993.43968.43908.43927.43979.43976.43993.43990.43910.43954.43908.43927.43995.43991.43996.43997.43910.43908.43927.43976.43978.43997.43910.43908.43927.43996.43985.43982.43910.43908.43927.43980.43996.43910.43908.43927.43980.43978.43910.43908.43927.43980.43993.43994.43988.43997.43910.43908.43927.43996.43985.43982.43910.43954.43908.43976.43910.43908.43979.43976.43993.43990.43928.43995.43988.43993.43979.43979.43909.43930.43978.43997.43989.44007.43998.43993.43987.43997.44007.43984.43915.43930.43910.44010.43997.43989.43993.43978.43977.43981.43997.43979.43928.43906.43908.43927.43979.43976.43993.43990.43910.43908.43927.43976.43910.43954.43908.43976.43910.44028.43993.43990.43979.43928.43995.43997.43980.43928.43997.43968.43997.43978.43995.43985.43995.43997.43924.43928.43988.43997.43928.43980.43993.43994.43988.43997.43993.43981.43928.43976.43978.43985.43979.43928.43997.43990.43928.43976.43993.43978.43993.43989.43856.43980.43978.43997.43928.43908.43995.43991.43996.43997.43910.43989.43997.43979.43981.43978.43997.43979.43908.43927.43995.43991.43996.43997.43910.43928.43993.43928.43857.43980.43857.43928.43989.43991.43996.43985.43998.43985.43857.43928.43908.43979.43980.43978.43991.43990.43999.43910.43997.43990.43928.43976.43988.43993.43995.43997.43908.43927.43979.43980.43978.43991.43990.43999.43910.43926.43928.44008.43993.43978.43998.43991.43985.43979.43924.43928.43990.43991.43981.43979.43928.43990.43997.43928.43982.43991.43981.43988.43991.43990.43979.43928.43976.43993.43979.43924.43928.43993.43981.43928.43995.43991.43990.43980.43978.43993.43985.43978.43997.43924.43928.43977.43981.43935.43981.43990.43928.43980.43993.43994.43988.43997.43993.43981.43928.43976.43978.43985.43979.43928.43997.43990.43928.43976.43993.43978.43993.43989.43856.43980.43978.43997.43928.43979.43991.43985.43980.43928.43989.43991.43996.43985.43998.43985.43857.43926.43928.43908.43927.43976.43910.43954.43908.43976.43910.90097.43928.44008.43991.43981.43978.43928.43994.43985.43997.43990.43928.43995.43991.43989.43976.43978.43997.43990.43996.43978.43997.43928.43988.43993.43928.43996.43985.43998.43998.43857.43978.43997.43990.43995.43997.43924.43928.43982.43991.43981.43979.43928.43976.43991.43981.43982.43997.43970.43928.43995.43984.43997.43978.43995.43984.43997.43978.43928.43864.43928.43978.43857.43979.43991.43981.43996.43978.43997.43928.43988.43935.43997.43968.43997.43978.43995.43985.43995.43997.43928.43930.44010.43997.43989.43976.43988.43993.43995.43997.43978.43928.43981.43990.43997.43928.43982.43993.43988.43997.43981.43978.43930.43926.43908.43927.43976.43910.43954.43908.43927.43996.43997.43980.43993.43985.43988.43979.43910.43954.43908.43927.43996.43985.43982.43910