 Ndenge nini koluka maximum mpe minimum ya ensemble ya ba nombres?
Mpo na koluka maximum mpe minimum ya ensemble ya ba nombres, okoki kolanda ba étapes oyo elandi na kosalelaka array ya entrée oyo epesami lokola exemple. Array ya entrée : [5, 3, 9, 4, 1] 1. Initialiser ba variables mibale pona kobomba ba valeurs maximales na minimum. Okoki ko assigner élément ya liboso ya array na ba variables nionso mibale pona kobanda. max = min = 5 2. Kozongela na nzela ya array, kokokanisa élément moko moko na valeur maximale na minimum ya lelo. Soki élément ezali monene koleka maximum ya lelo, mise à jour maximum. Soki élément ezali moke koleka minimum ya lelo, mise à jour minimum. mpo na num na [5, 3, 9, 4, 1]: soki num > max: max = num elif num < min: min = num 3. Sima ya boucle, ba variables maximales na minimum ekozala na ba valeurs maximales na minimum ya na molɔngɔ́ ya biloko. maximum = 9 minimum = 1 Na lolenge mosusu, okoki kosalela ba fonctions intégrées na ba langues mingi ya programmation pona koluka ba valeurs maximales na minimum ya array. Na Python, ndakisa, okoki kosalela ba fonctions max() na min(): my_array = [5, 3, 9, 4, 1] maximum = max(my_array) minimum = min(my_array) Na cas nionso mibale, maximum mpe minimum ya array ya entrée [5, 3, 9, 4, 1] ezali 9 mpe 1 respectivement.