diff --git a/DS/anniversaires_eleves_isen.txt b/DS/anniversaires_eleves_isen.txt new file mode 100644 index 0000000..4980ea1 --- /dev/null +++ b/DS/anniversaires_eleves_isen.txt @@ -0,0 +1,262 @@ +16/08/2004,CSI1 +06/02/2003,CSI1 +07/01/2002,CSI1 +19/06/2002,CSI1 +21/06/2004,CSI1 +18/08/2004,CSI1 +30/03/2003,CSI1 +01/02/2004,CSI1 +29/07/2004,CSI1 +04/06/2004,CSI1 +28/11/2003,CSI1 +06/01/2004,CSI1 +03/06/2004,CSI1 +22/05/2004,CSI1 +10/03/2004,CSI1 +17/05/2003,CSI1 +19/08/2004,CSI1 +09/10/2004,CSI1 +15/09/2004,CSI1 +19/07/2004,CSI1 +28/11/2000,CSI1 +26/12/2003,CSI1 +13/10/2004,CSI1 +01/11/2004,CSI1 +22/05/2004,CSI1 +04/05/2004,CSI1 +13/01/2004,CSI1 +20/01/2004,CSI1 +16/05/2004,CIR1 +31/10/2005,CIR1 +15/08/2004,CIR1 +08/12/2004,CIR1 +05/08/2004,CIR1 +27/02/2004,CIR1 +19/11/2003,CIR1 +09/09/2004,CIR1 +27/11/2003,CIR1 +19/04/2005,CIR1 +16/03/2004,CIR1 +18/12/2003,CIR1 +18/08/2004,CIR1 +25/01/2004,CIR1 +12/03/2004,CIR1 +08/08/2004,CIR1 +27/05/2004,CIR1 +01/09/2004,CIR1 +19/10/2003,CIR1 +29/01/2005,CIR1 +13/06/2004,CIR1 +09/12/2004,CIR1 +19/11/2003,CIR1 +14/12/2004,CIR1 +18/11/2004,CIR1 +09/01/2005,CIR1 +29/04/2003,CSI2 +20/03/2003,CSI2 +19/11/2002,CSI2 +05/09/2003,CSI2 +18/04/2003,CSI2 +26/06/2003,CSI2 +23/07/2003,CSI2 +28/06/2003,CSI2 +09/01/2003,CSI2 +12/07/2001,CSI2 +18/03/2003,CSI2 +21/11/2003,CSI2 +24/06/2004,CSI2 +16/10/2003,CSI2 +14/09/2002,CSI2 +02/12/2003,CSI2 +16/09/2003,CSI2 +06/08/2002,CSI2 +04/12/2003,CSI2 +14/06/2003,CSI2 +06/06/2002,CSI2 +16/01/2003,CSI2 +05/03/2003,CSI2 +13/01/2003,CSI2 +21/07/2003,CSI2 +08/03/2003,CSI2 +20/01/2003,CSI2 +22/01/2003,CSI2 +19/01/2004,CSI2 +22/12/2004,CSI2 +23/09/2003,CIR2 +17/12/2003,CIR2 +29/12/2003,CIR2 +22/07/2003,CIR2 +28/12/2002,CIR2 +09/08/2003,CIR2 +24/01/2003,CIR2 +24/06/2003,CIR2 +14/08/2003,CIR2 +30/05/2003,CIR2 +22/12/2003,CIR2 +09/09/2003,CIR2 +27/08/2003,CIR2 +23/08/2003,CIR2 +18/09/2003,CIR2 +03/12/2003,CIR2 +02/02/2003,CIR2 +12/05/2003,CIR2 +30/04/2003,CIR2 +20/06/2003,CIR2 +05/08/2002,CIR2 +02/12/2003,CIR2 +20/11/2003,CIR2 +05/11/2002,CIR2 +31/03/2003,CIR2 +07/05/2002,A3 +05/02/2003,A3 +18/05/2002,A3 +20/04/2002,A3 +02/01/2002,A3 +07/01/2002,A3 +20/09/2003,A3 +17/02/2002,A3 +17/11/2002,A3 +03/04/2002,A3 +23/05/2003,A3 +30/09/2001,A3 +01/12/2001,A3 +22/09/2002,A3 +01/12/2002,A3 +08/04/2002,A3 +10/10/2002,A3 +15/04/2002,A3 +07/06/2003,A3 +13/02/2003,A3 +07/02/2001,A3 +31/01/2001,A3 +01/09/2002,A3 +09/04/2002,A3 +22/12/2002,A3 +24/04/2000,A3 +04/01/2001,A3 +19/04/2002,A3 +12/03/2002,A3 +26/08/2002,A3 +29/10/2002,A3 +05/12/2002,A3 +10/11/2002,A3 +11/09/2002,A3 +29/08/2002,A3 +11/08/2001,A3 +04/09/2002,A3 +13/04/2002,A3 +05/06/2002,A3 +01/03/2002,A3 +09/01/2002,A3 +01/06/2001,A3 +26/08/2002,A3 +31/12/2002,A3 +15/06/2002,A3 +28/02/2002,A3 +17/05/2002,A3 +13/05/2002,A3 +23/11/2001,A3 +01/07/2002,A3 +09/02/2002,A3 +09/04/2002,A3 +14/08/2002,A3 +23/04/2003,A3 +24/10/2002,A3 +28/02/2001,M1 +31/10/2001,M1 +10/07/2001,M1 +10/07/2001,M1 +19/04/2002,M1 +30/09/2001,M1 +04/01/2002,M1 +15/12/2001,M1 +12/07/2002,M1 +26/08/2001,M1 +10/12/2001,M1 +13/01/2002,M1 +12/02/2000,M1 +20/04/2001,M1 +24/04/2002,M1 +07/10/1999,M1 +02/12/2001,M1 +09/06/2001,M1 +08/10/2001,M1 +18/07/2001,M1 +13/05/2000,M1 +23/01/2001,M1 +27/07/2001,M1 +28/09/2001,M1 +07/03/2001,M1 +06/06/2002,M1 +12/08/2001,M1 +06/10/2001,M1 +05/07/2001,M1 +04/07/2001,M1 +01/04/2001,M1 +14/10/2001,M1 +16/01/2001,M1 +06/11/2001,M1 +06/12/2001,M1 +26/10/2000,M1 +06/02/2000,M1 +09/11/2001,M1 +14/08/2001,M1 +10/03/2001,M1 +10/07/2001,M1 +24/07/2000,M1 +21/12/2001,M1 +13/10/1999,M1 +26/06/2001,M1 +12/08/2001,M1 +15/06/2001,M1 +19/08/2001,M1 +20/10/2001,M1 +06/05/2001,M1 +21/11/2001,M1 +19/04/2001,M1 +01/04/2001,M1 +31/12/2000,M1 +06/12/2000,M1 +11/07/2001,M1 +04/12/2001,M1 +18/03/2001,M1 +23/04/2002,M1 +25/04/2000,M2 +17/05/2001,M2 +06/10/2000,M2 +21/10/2000,M2 +11/05/2000,M2 +18/03/2000,M2 +18/09/2000,M2 +16/07/2000,M2 +12/07/2000,M2 +22/07/2000,M2 +26/01/1999,M2 +26/07/2000,M2 +02/05/2000,M2 +01/04/1998,M2 +04/01/2001,M2 +05/03/2000,M2 +05/04/2000,M2 +25/09/2000,M2 +16/11/1999,M2 +27/02/2001,M2 +09/04/2000,M2 +31/10/2000,M2 +18/01/2001,M2 +27/10/1999,M2 +02/08/2000,M2 +21/02/2000,M2 +06/10/2000,M2 +11/04/2000,M2 +07/04/1999,M2 +06/10/2000,M2 +01/02/1997,M2 +11/11/2000,M2 +12/12/2000,M2 +01/10/1999,M2 +16/12/2000,M2 +30/10/2000,M2 +17/03/2000,M2 +14/03/2000,M2 +25/07/2000,M2 diff --git a/DS/exercice1.py b/DS/exercice1.py new file mode 100644 index 0000000..9ef8568 --- /dev/null +++ b/DS/exercice1.py @@ -0,0 +1,21 @@ +def transform_letter_in_number(letter): + return ord(letter) - 64 + + +def isNumberValid(idNumber): + strIdNumberWith2First = "" + for i in range(len(idNumber)): + if i == 0 or i == 1: + strIdNumberWith2First += str(transform_letter_in_number(idNumber[i])) + else: + strIdNumberWith2First += str(idNumber[i]) + idNumberWith2First = int(strIdNumberWith2First) + reste = idNumberWith2First % 9 + if reste == 7: + return True + else: + return False + + +idNumber = "UF9052784116" +print(isNumberValid(idNumber)) diff --git a/DS/exercice2.py b/DS/exercice2.py new file mode 100644 index 0000000..4c2a2e1 --- /dev/null +++ b/DS/exercice2.py @@ -0,0 +1,49 @@ +def calcul_mensualite(): + C = int(input("entrer le capital > ")) + while C < 0: + print("Le capital ne peut pas être négatif") + C = int(input("entrer le capital > ")) + n = int(input("entrer la duree > ")) + while n < 0: + print('La duree ne peut pas être négative') + n = int(input("entrer la duree > ")) + t = int(input("entrer le taux > ")) + while t < 0: + print("Le taux ne peut pas être négatif") + t = int(input("entrer le taux > ")) + print("liste retournée par la fonction emprunt") + print(emprunt(C, n, t)) + + +def mensualite(capital, duree, taux): + numerateur = capital * (taux / 12) + denominateur = 1 - ((1 + (taux / 12)) ** -duree) + print(numerateur) + print() + print(denominateur) + mensualite = numerateur / denominateur + return mensualite + + +def emprunt(capital, duree, taux): + i = duree + interet = taux / 12 + interetCumul = 0 + bigL = [] + while i > 0: + print(i) + L = [] + interetPaye = capital * interet + m = mensualite(capital, i, taux) + capital = capital + interetPaye - m + interetCumul += interet + L.append(capital) + L.append(interetCumul) + L.append(interet) + interet -= 0.27 + bigL.append(L) + i -= 1 + return bigL + + +calcul_mensualite() diff --git a/DS/exercice3.py b/DS/exercice3.py new file mode 100644 index 0000000..18d30f9 --- /dev/null +++ b/DS/exercice3.py @@ -0,0 +1,107 @@ +import matplotlib.pyplot as plot +import numpy as np +import math + + +def probabilite_differents(): + L = [] + for n in range(0, 90): + eq = (math.factorial(365) / math.factorial(365 - n)) * (1 / (365 ** n)) + L.append(eq) + return L + + +def probabilite_identique(): + L = [] + probaDiff = probabilite_differents() + for n in range(len(probaDiff)): + eq = 1 - probaDiff[n] + L.append(eq) + return L + + +def tracer_courbe_proba(): + probaDiff = probabilite_differents() + probaInde = probabilite_identique() + plot.plot(0, probaDiff) + plot.show() + + +def calculer_nb_lignes(nom_fichier): + file = open(nom_fichier, "r") + nb_lignes = 0 + for line in file: + nb_lignes += 1 + file.close() + return nb_lignes + + +def nombre_eleves_par_classe(nom_fichier): + fichier = open(nom_fichier, "r") + dico = {} + for ligne in fichier: + classe = ligne.split(',')[1][:-1] + if classe in dico: + dico[classe] += 1 + else: + dico[classe] = 1 + fichier.close() + return dico + + +def check_same_birthday(promo, nom_fichier): + fichier = open(nom_fichier, "r") + BDayList = [] + for ligne in fichier: + classe = ligne.split(',')[1][:-1] + if classe == promo: + BDay = ligne.split(',')[0] + BDayList.append(BDay) + for i in range(len(BDayList) - 1): + j = i + 1 + while j < len(BDayList): + if BDayList[i] == BDayList[j]: + fichier.close() + return True, BDayList[i] + j += 1 + fichier.close() + return False, None + + +def nb_days_identical(promo, nom_fichier): + fichier = open(nom_fichier, "r") + dico = {} + BDayList = [] + for ligne in fichier: + classe = ligne.split(',')[1][:-1] + if classe == promo: + BDay = ligne.split(',')[0] + BDayList.append(BDay) + for i in range(len(BDayList) - 1): + if(BDayList[i] in dico): + dico[BDayList[i]] += 1 + else: + dico[BDayList[i]] = 1 + fichier.close() + return dico + + +def get_identical_days(dico): + ''' + for i in dico: + if dico[i].key >= 2: + ''' + return + + +print(nombre_eleves_par_classe("anniversaires_eleves_isen.txt")) +# tracer_courbe_proba() +classes = ('CSI1', 'CSI2', 'CIR1', 'CIR2', 'A3', 'M1', 'M2') +same_bithday_class = [] +for c in classes: + same_bithday_class.append(check_same_birthday(c, "anniversaires_eleves_isen.txt")) +print(same_bithday_class) +for c in classes: + d = nb_days_identical(c, "anniversaires_eleves_isen.txt") + print(d) + #print(f"nombre de jours avec plus d'un anniversaire {get}") \ No newline at end of file diff --git a/Fouche_Clement_EVAL/ex1.py b/Fouche_Clement_EVAL/ex1.py new file mode 100644 index 0000000..484fa11 --- /dev/null +++ b/Fouche_Clement_EVAL/ex1.py @@ -0,0 +1,24 @@ +def checkIfPrimeNumber(n): + if n % n == 0 & n % 1 == 0: + for i in range(2, n): + if n % i == 0: + return False + return True + else: + return False + +def circulaire(n): + toTest = [] + toTest.append(n) + for i in range(len(str(n)) - 1): + toTest.append(int(str(toTest[i])[-1] + str(toTest[i])[:-1])) + print(toTest) + for number in toTest: + if checkIfPrimeNumber(number) == False: + return False + return True + +if __name__ == '__main__': + print('719 est circulaire : ', circulaire(719)) + print('23 est circulaire : ', circulaire(23)) + print('6102 est circulaire : ', circulaire(6102)) diff --git a/Fouche_Clement_EVAL/ex2.py b/Fouche_Clement_EVAL/ex2.py new file mode 100644 index 0000000..7bb76c9 --- /dev/null +++ b/Fouche_Clement_EVAL/ex2.py @@ -0,0 +1,42 @@ +class Personne: + def __init__(self, name, age): + self.__age = age + self.__name = name + + def get_nom(self): + return self.__name + + def get_age(self): + return self.__age + + def increment_age(self): + self.__age = self.__age + 1 + + +class Eleve(Personne): + def __init__(self, name, age, section): + super().__init__(name, age) + self.section = section + + +class Prof(Personne): + def __init__(self, name, age, matiere): + super().__init__(name, age) + self.matiere = matiere + + +def calcule_moyenne_age(personnes): + total = 0 + for personne in personnes: + total += personne.get_age() + return total / len(personnes) + +if __name__ == '__main__': + eleve1 = Eleve('eleve1', 19, 'CIR2') + print(f"l'élève {eleve1.get_nom()} de la section {eleve1.section} a {eleve1.get_age()} ans") + eleve1.increment_age() + print(f"l'élève {eleve1.get_nom()} de la section {eleve1.section} a maintenant {eleve1.get_age()} ans") + prof1 = Prof('prof1', 40, 'java') + prof2 = Prof('prof2', 50, 'python') + print(f"l'âge moyen des profeseurs est {calcule_moyenne_age((prof1, prof2))} ans") + print(f"l'âge moyen des profeseurs et étudiants est {calcule_moyenne_age((prof1, prof2, eleve1)) : 0.2f} ans") diff --git a/Fouche_Clement_EVAL/ex3.py b/Fouche_Clement_EVAL/ex3.py new file mode 100644 index 0000000..40379a6 --- /dev/null +++ b/Fouche_Clement_EVAL/ex3.py @@ -0,0 +1,38 @@ +import cmath +import turtle +import time + +turtle.speed('fastest') +def get_racine(radius, number): + out = [] + com = cmath.sqrt(radius ** 2 - (radius / 2) ** 2) + for i in range(number): + com = com * cmath.exp(2j * cmath.pi / number) + out.append(com) + return out + + +def printminicircle(x, y, radius=3): + turtle.up() + turtle.goto(x, y) + turtle.down() + turtle.filling() + turtle.fillcolor(0, 0, 0) + turtle.begin_fill() + turtle.circle(radius) + turtle.end_fill() + + +def draw(): + i = 1 + path = get_racine(100, 60) + while i > -1: + for point in path: + printminicircle(point.real, point.imag) + time.sleep(1) + turtle.clear() + i = i + 1 + +if __name__ == '__main__': + draw() + diff --git a/coderpad-python-magic-methods-cheat-sheet-1024x799.png b/coderpad-python-magic-methods-cheat-sheet-1024x799.png new file mode 100644 index 0000000..8a3572f Binary files /dev/null and b/coderpad-python-magic-methods-cheat-sheet-1024x799.png differ