Statistiques descriptives en Python
2015-08-22notes = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
print « Notes: « ,notes
def print_notes(notes):
for note in notes:
print note
def somme_notes(notes):
total = 0
for note in notes:
total += note
return total
def moyenne_notes(notes):
somme_des_notes = somme_notes(notes)
moyenne = somme_des_notes / float(len(notes))
return moyenne
def variance_notes(notes):
moyenne = moyenne_notes(notes)
variance = 0
for note in notes:
variance += (moyenne – note)**2
variancetotal = variance/float(len(notes))
return variancetotal
def ecart_type_notes(nombre):
nombre = nombre
return nombre**0.5
print notes
print somme_notes(notes)
print moyenne_notes(notes)
print variance_notes(notes)
print ecart_type_notes(variance_notes(notes))