Skip to content
Snippets Groups Projects
Commit 601e3af8 authored by Angy Wallot's avatar Angy Wallot
Browse files

tp.4

parent 09516976
Branches
No related tags found
No related merge requests found
......@@ -86,10 +86,6 @@ class Etudiant:
return f"{self.nip} : {self.prenom} {str.upper(self.nom)}"
if (__name__ == "__main__"):
import apl1test
apl1test.testmod('etudiant.py')
def charge_fichier_etudiants(fname: str) -> list[Etudiant]:
"""
......@@ -111,4 +107,32 @@ def charge_fichier_etudiants(fname: str) -> list[Etudiant]:
return res
L_ETUDIANTS = charge_fichier_etudiants("etudiants.csv")
COURTE_LISTE = [L_ETUDIANTS[:10]]
\ No newline at end of file
COURTE_LISTE = L_ETUDIANTS[:10]
def est_liste_d_etudiants(x) -> bool:
"""
Renvoie True si ``x`` est une liste de d'étudiant, False dans le cas contraire.
Précondition: aucune
Exemples:
$$$ est_liste_d_etudiants(COURTE_LISTE)
True
$$$ est_liste_d_etudiants("Timoleon")
False
$$$ est_liste_d_etudiants([('12345678', 'Calbuth', 'Raymond', 'Danse', '12') ])
False
"""
res = isinstance(x, list)
if res == True:
for el in x:
res = isinstance(el, Etudiant)
return res
NBRE_ETUDIANTS = len(L_ETUDIANTS)
if (__name__ == "__main__"):
import apl1test
apl1test.testmod('etudiant.py')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment