diff --git a/projet_conso.py b/projet_conso.py index 688f570..9d9c4e8 100644 --- a/projet_conso.py +++ b/projet_conso.py @@ -1,4 +1,7 @@ + + +""" def lecture(nom) : lst_picjournalier = [] @@ -20,9 +23,26 @@ def lecture(nom) : print(lst_temperatureref) lecture("conso.csv") +""" + def numerojour(date) : + """elle prend en parametre une date ecrite en chaîne de caractere separée par des tirets + et elle renvoie un numero de jour entre 1 et 365""" + separation = date.split("-") + annee = int(separation[0]) + mois = int(separation[1]) + jour = int(separtation[2]) + jours_mois = [31,28,31,30,31,30,31,31,30,31,30,31] + if estbissextile(annee) : + jours_mois[1] = 29 + numero = jour + i = 0 + while i < mois - 1 : + numero = numero + jours_mois[i] + i = i + 1 + return numero @@ -31,7 +51,15 @@ def numerojour(date) : def estbissextile(annee) : - for annee in nom : - if annee % 4 == 0 and annee % 100 != 0 and annee % 400 == 0 : - True + """ prend en parametre une annee et verifie si elle est bissextile ou non """ + if annee % 4 == 0: + if annee % 400 == 0 : + return True + if annee % 100 != 0 : + return True return False + + + + +