TP1 Coordination questions
This commit is contained in:
parent
307ead5180
commit
35d2c56834
|
@ -7,9 +7,10 @@
|
|||
|
||||
from etudiants import *
|
||||
|
||||
# Question 1
|
||||
def question(numero):
|
||||
print('\n***', 'Question', numero, "***")
|
||||
|
||||
print("\n *** Question 1 ***")
|
||||
question(1)
|
||||
|
||||
assert(type(l_etudiants) == type([]))
|
||||
|
||||
|
@ -23,22 +24,19 @@ for i in l_etudiants:
|
|||
|
||||
print("La liste l_etudiant est correcte")
|
||||
|
||||
# Question 2
|
||||
|
||||
print("\n *** Question 2 ***")
|
||||
question(2)
|
||||
|
||||
print("Il y a ", len(l_etudiants), " étudiants dans la liste")
|
||||
|
||||
# Question 3
|
||||
|
||||
print("\n *** Question 3 ***")
|
||||
question(3)
|
||||
|
||||
|
||||
print(l_etudiants[11501230%len(l_etudiants)])
|
||||
|
||||
# Question 4
|
||||
|
||||
print("\n *** Question 4 ***")
|
||||
question(4)
|
||||
|
||||
formations = ["LICAM", "MASS", "PEIP", "SESI"]
|
||||
erreur = False
|
||||
|
@ -51,9 +49,8 @@ for i in l_etudiants:
|
|||
if not erreur:
|
||||
print("Tous les étudiants sont dans une formation.")
|
||||
|
||||
# Question 5
|
||||
|
||||
print("\n *** Question 5 ***")
|
||||
question(5)
|
||||
|
||||
|
||||
def nbre_prenoms(prenom):
|
||||
|
@ -76,9 +73,8 @@ def nbre_prenoms(prenom):
|
|||
print("Il y a ", nbre_prenoms("Alexandre"), " étudiants qui s'appellent Alexandre")
|
||||
print("Il y a ", nbre_prenoms("Camille"), " étudiantes qui s'appellent Camille")
|
||||
|
||||
# Question 6
|
||||
|
||||
print("\n *** Question 6 ***")
|
||||
question(6)
|
||||
|
||||
prenomsUniques = set()
|
||||
|
||||
|
@ -88,9 +84,8 @@ for i in l_etudiants:
|
|||
|
||||
print("Il y a ", len(prenomsUniques), " prénoms différents")
|
||||
|
||||
# Question 7
|
||||
|
||||
print("\n *** Question 7 ***")
|
||||
question(7)
|
||||
|
||||
lPrenoms=[i[2] for i in l_etudiants]
|
||||
|
||||
|
@ -104,9 +99,8 @@ for i in prenomsUniques:
|
|||
|
||||
print("Le prénom le plus courant est ", freq[0], " avec ", freq[1], " personnes portant ce prénom.")
|
||||
|
||||
# Question 8
|
||||
|
||||
print("\n *** Question 8 ***")
|
||||
question(8)
|
||||
|
||||
idUniques = set()
|
||||
|
||||
|
@ -118,9 +112,8 @@ if len(idUniques) != len(l_etudiants):
|
|||
else:
|
||||
print("Tous les id sont uniques")
|
||||
|
||||
# Question 9
|
||||
|
||||
print("\n *** Question 9 ***")
|
||||
question(9)
|
||||
|
||||
nbLICAM = nbMASS = nbPEIP = nbSESI = 0
|
||||
|
||||
|
@ -138,7 +131,7 @@ print("Il y a ", nbLICAM, " étudiants en LICAM ", nbMASS, " en MASS ", nbPEIP,
|
|||
|
||||
# Question 10
|
||||
|
||||
print("\n *** Question 10 ***")
|
||||
question(10)
|
||||
|
||||
def liste_formation(form):
|
||||
""" str -> liste de quadruplets, renvoie la liste des étudiants dans la formation passée en paramètre
|
||||
|
@ -160,9 +153,6 @@ print("Liste des PEIP:\n", liste_formation("PEIP"))
|
|||
|
||||
# Geoffrey
|
||||
|
||||
def question(numero):
|
||||
print('\n***', 'Question', numero, "***")
|
||||
|
||||
question(1)
|
||||
|
||||
test = type(l_etudiants) is list
|
||||
|
|
Reference in a new issue