Le slice contient les températures d’une semaine (au moins un jour). Écris MinMax(temps) pour renvoyer la plus basse et la plus haute, les deux à la fois.
MinMax([]int{18, 25, 21})→(18, 25)MinMax([]int{7})→(7, 7)func MinMax(temps []int) (int, int)package main
func MinMax(temps []int) (int, int) {
low, high := temps[0], temps[0]
for _, t := range temps {
// ton code ici: plus bas que low? remplace low. Plus haut que high? remplace high
}
return low, high
}
Exécuter teste les exemples. Quand ils sont bons, appuie sur Envoyer.