script python
This commit is contained in:
23
sio2/sisr2/30-Python/Exo2
Normal file
23
sio2/sisr2/30-Python/Exo2
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/python3
|
||||
moyenne=0
|
||||
Tableau=[]
|
||||
#boucle for
|
||||
for i in range(5):
|
||||
valeur = input("Donner un nombre: ")
|
||||
Tableau.append(valeur)
|
||||
|
||||
#plus petite élément et plus grand
|
||||
max=Tableau[0]
|
||||
min=Tableau[0]
|
||||
for valeur in Tableau:
|
||||
if valeur > max:
|
||||
max = valeur
|
||||
if valeur<min:
|
||||
min=valeur
|
||||
moyenne=moyenne+int(valeur)
|
||||
|
||||
moyenne=moyenne/5
|
||||
|
||||
for valeur in range(5):
|
||||
print(Tableau[valeur])
|
||||
print("Le plus petit est",min,"le plus grand est",max,"la moyenne est",moyenne)
|
Reference in New Issue
Block a user