modifié : sio2/sisr/20-python/exo2.py

nouveau fichier : sio2/sisr/20-python/exo4.py
This commit is contained in:
root 2024-10-03 11:16:45 +02:00
parent d59aa1571c
commit f2299ee7c1
2 changed files with 31 additions and 1 deletions
sio2/sisr/20-python

@ -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}")

@ -0,0 +1 @@
#!