Ajout du tp de python et regex
This commit is contained in:
30
sisr2/sisr/35-python/exo2.py
Normal file
30
sisr2/sisr/35-python/exo2.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
tableau = []
|
||||
min = 0
|
||||
max = 0
|
||||
cumul = 0
|
||||
|
||||
print("entrer 5 chiffres")
|
||||
for i in range(5):
|
||||
nombre = float(input(f"Chiffre {i+1} : "))
|
||||
tableau.append(nombre)
|
||||
|
||||
|
||||
for l in tableau:
|
||||
if l < min:
|
||||
min = l
|
||||
if l > max:
|
||||
max = l
|
||||
cumul = cumul + l
|
||||
|
||||
for l
|
||||
moyenne = cumul / 5
|
||||
|
||||
|
||||
for l in tableau:
|
||||
print(tableau[i])
|
||||
|
||||
print("le plus petit:", min)
|
||||
print("le plus grand:", max)
|
||||
print("la moyenne", moyenne)
|
||||
Reference in New Issue
Block a user