Skip to content
Snippets Groups Projects
Commit f4152d9a authored by Romain Vuillemot's avatar Romain Vuillemot
Browse files

Corrections mineurs

parent 5c533257
No related branches found
No related tags found
No related merge requests found
from File import *
if __name__=="__main__":
data = []
with open("etudiants.txt") as f:
keys = None
for line in f:
l = [w.strip() for w in line.split(';')]
if keys is None:
keys = l
else:
data.append({k:v for k, v in zip(keys, l)})
file = File()
for d in data:
file.ajoute(d)
e = file.renvoie(lambda x : x['filiere'] == "PC")
print(e['nom'] + " " + e['prenom'])
\ No newline at end of file
from Pile import *
if __name__=="__main__":
data = []
with open("etudiants.txt") as f:
keys = None
for line in f:
l = [w.strip() for w in line.split(';')]
if keys is None:
keys = l
else:
data.append({k:v for k, v in zip(keys, l)})
p = Pile()
for d in data:
p.ajoute(d)
e = p.supprime()
assert(e['nom'] == "Arthaud" and e['prenom'] == "Nathalie")
\ No newline at end of file
from Tas import *
if __name__=="__main__":
data = []
with open("etudiants.txt") as f:
keys = None
for line in f:
l = [w.strip() for w in line.split(';')]
if keys is None:
keys = l
else:
data.append({k:v for k, v in zip(keys, l)})
tas = Tas()
for d in data:
tas.ajoute(int(d['moyenne']))
r = tas.get_racine()
fg, fg_i = tas.get_fils_gauche(0)
ffg, ffg_i = tas.get_fils_droit(0)
assert(r == 19 and fg == 14 and ffg == 16)
\ No newline at end of file
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment