Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AP-WALLOT-Angy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Angy Wallot
AP-WALLOT-Angy
Commits
601e3af8
Commit
601e3af8
authored
1 year ago
by
Angy Wallot
Browse files
Options
Downloads
Patches
Plain Diff
tp.4
parent
09516976
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tp.4/etudiants/etudiant.py
+29
-5
29 additions, 5 deletions
tp.4/etudiants/etudiant.py
with
29 additions
and
5 deletions
tp.4/etudiants/etudiant.py
+
29
−
5
View file @
601e3af8
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment