modifié : sio2/sisr/20-python/exo2.py
nouveau fichier : sio2/sisr/20-python/exo4.py
This commit is contained in:
parent
d59aa1571c
commit
f2299ee7c1
@ -1 +1,30 @@
|
|||||||
#!
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
# Initialiser un tableau vide
|
||||||
|
tableau = []
|
||||||
|
for i in range(5):
|
||||||
|
chiffre = float(input(f"Entrez le chiffre {i+1} : "))
|
||||||
|
tableau.append(chiffre)
|
||||||
|
|
||||||
|
|
||||||
|
mini = tableau[0]
|
||||||
|
maxi = tableau[0]
|
||||||
|
cumul = 0
|
||||||
|
for chiffre in tableau:
|
||||||
|
if chiffre < mini:
|
||||||
|
mini = chiffre
|
||||||
|
if chiffre > maxi:
|
||||||
|
maxi = chiffre
|
||||||
|
cumul+= chiffre
|
||||||
|
|
||||||
|
|
||||||
|
moyenne = cumul / len(tableau)
|
||||||
|
|
||||||
|
|
||||||
|
print("Le tableau est :")
|
||||||
|
for chiffre in tableau:
|
||||||
|
print(chiffre)
|
||||||
|
print(f"Le plus petit élément est : {mini}")
|
||||||
|
print(f"Le plus grand élément est : {maxi}")
|
||||||
|
print(f"La moyenne est : {moyenne}")
|
||||||
|
|
||||||
|
1
sio2/sisr/20-python/exo4.py
Normal file
1
sio2/sisr/20-python/exo4.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
#!
|
Loading…
x
Reference in New Issue
Block a user