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

mise à jour S6 22-23

parent 6e2ecd2a
Branches
No related tags found
No related merge requests found
Showing with 0 additions and 336864 deletions
class Pile():
def __init__(self, values = []):
self.__values = []
for v in values:
self.ajoute(v)
def ajoute(self, v):
self.__values.append(v)
return v
def supprime(self):
v = self.__values.pop()
return v
def affiche(self):
for v in self.__values:
print(v)
def taille(self):
return len(self.__values)
\ No newline at end of file
nom;prenom;filiere;moyenne;absences
Dickerson;Chaney;PSI;6;4
King;Shay;PSI;2;2
Chan;Aileen;MP;8;3
Schwartz;Destiny;PSI;16;5
Parrish;Prescott;MP;1;4
Calhoun;Brenda;PSI;10;4
Watts;Shellie;PSI;6;4
Baird;Octavius;PC;4;2
Graves;Vanna;MP;10;0
Decker;Nerea;PSI;9;4
Townsend;Naomi;PC;13;3
Decker;Nichole;PSI;10;3
Mcgee;Blythe;PSI;7;0
Franco;Cyrus;PSI;12;1
Mcdowell;Zelda;MP;6;1
Cherry;Stone;PSI;10;5
Mendoza;Kirsten;PC;18;0
Mathis;Xaviera;MP;12;1
Booker;Gretchen;MP;2;1
Hansen;Slade;PSI;1;1
Mason;Forrest;MP;13;3
Wolfe;Fatima;PC;15;5
Richards;Justine;MP;20;0
Kelley;Abra;PC;2;4
Lang;Ulysses;PSI;2;5
Barker;Austin;MP;15;5
Cannon;Kalia;MP;3;4
Higgins;Charity;PSI;18;5
Parker;Fritz;PC;14;2
Chambers;Yvette;PSI;7;1
Vinson;Denise;PSI;3;5
Mcmillan;Chava;PSI;7;3
Gallegos;Lee;PC;16;0
Ferguson;Solomon;PSI;11;4
Camacho;Zena;MP;4;4
Sexton;Fallon;PSI;16;2
Campbell;Preston;PC;0;0
Greer;Lance;PC;15;5
Oliver;Aileen;PC;10;2
Nielsen;Timon;PC;1;2
Perkins;Roth;PSI;1;2
Beard;Blair;PSI;13;1
Burgess;Keely;PSI;4;4
Wells;Honorato;PSI;17;0
Richardson;Cherokee;PC;20;1
Burgess;Blair;PC;16;4
Rice;Florence;PC;7;4
Villarreal;Delilah;MP;9;5
Cherry;Maite;MP;0;2
Berry;Jermaine;MP;17;4
Shepherd;Alfreda;PSI;20;5
Workman;April;PC;3;1
Carter;Herman;PC;11;1
Carpenter;Teagan;MP;0;1
Fowler;Leo;PSI;19;4
Mcgee;Kristen;PSI;9;4
Mcpherson;Channing;PC;0;0
Diaz;Nathaniel;PC;4;5
Klein;Maisie;PSI;16;3
Graham;Gary;MP;12;4
Jensen;Raja;PC;18;1
Wilkinson;Sawyer;PSI;10;0
Wagner;Lamar;MP;16;2
Abbott;Sybil;MP;17;1
Glenn;Arsenio;PSI;4;3
Moreno;Axel;PSI;7;4
Barrett;Dylan;PC;14;4
Keith;Rae;PC;9;1
Shepard;Rebecca;PC;8;5
Meyers;Illiana;MP;3;3
Bruce;Tatyana;MP;2;0
Mcguire;Olivia;PC;17;4
Merritt;Tatiana;PSI;19;3
Berg;Dale;MP;12;1
Matthews;Tallulah;MP;5;3
Steele;Cain;MP;8;2
Ellison;Britanni;PC;4;1
Richards;Audra;MP;15;0
Hood;Rylee;PSI;1;4
Townsend;Paul;PC;14;4
Cervantes;Thaddeus;MP;10;5
Dudley;Amela;PC;2;0
Lucas;Matthew;MP;4;1
Parrish;Nell;PC;13;3
Patterson;Bertha;PSI;18;0
Knapp;Lawrence;MP;3;5
Stanton;Keith;MP;5;2
Hayes;Mannix;PSI;3;2
Pearson;Ross;PC;10;4
Kaufman;Uta;MP;10;4
Bauer;Naida;PC;20;5
Carrillo;Quamar;PC;15;3
Orr;Lisandra;PSI;6;2
Randolph;Darryl;PSI;16;4
Boyer;Prescott;PC;20;2
Serrano;Ashely;PSI;10;2
Carney;Oren;PC;7;4
Riley;Arden;PC;1;5
Phillips;Joshua;PSI;20;3
Soto;Colt;PC;16;3
\ No newline at end of file
nom;prenom;filiere;note;absences
Dupond;Pierre;MP;19;7
Dupond;Jeanne;MP;19;5
Clavier;Christian;PSI;14;1
Gilles;Eric;PC;16;3
Arthaud;Nathalie;MP;15;0
\ No newline at end of file
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)})
print(data)
\ No newline at end of file
def selectionSort(l: list = []) -> list:
"""Tri par selection en ligne"""
for i in range(0, len(l)):
min = i
for j in range(i+1, len(l)):
if(l[j] < l[min]):
min = j
tmp = l[i]
l[i] = l[min]
l[min] = tmp
return l
if __name__=="__main__":
liste = [54,26,93,17,77,31,44,55,20]
assert(sorted(liste) == selectionSort(liste.copy()))
assert([] == selectionSort([]))
assert([1] == selectionSort([1]))
assert([1, 1] == selectionSort([1, 1]))
\ No newline at end of file
import time
import random
import matplotlib.pyplot as plt
nvalues = [100, 500, 1500, 2000, 2500, 3000]
timesSorted = []
timesSort = []
for i in nvalues:
random.seed()
p = 12**2
liste = []
for x in range(i): liste.append(random.randint(0, p))
c = liste.copy()
a=time.perf_counter()
triSorted = sorted(c)
b=time.perf_counter()
timesSorted.append(b-a)
c = liste.copy()
a=time.perf_counter()
triSort = c
triSort.sort()
b=time.perf_counter()
timesSort.append(b-a)
plt.plot(nvalues, timesSorted, "g-", label="Tri 1")
plt.plot(nvalues, timesSort, "b-", label="Tri 2")
plt.xlabel("Taille du jeu de données")
plt.ylabel("Temps")
plt.legend(loc="upper left")
plt.title("Comparaison des performances des algorithmes de tri")
plt.show()
\ No newline at end of file
import heapq
tas = []
for i in range(5): heapq.heappush(tas, i)
while not len(tas) == 0:
print(heapq.heappop(tas), end=" ")
# 0 1 2 3 4
\ No newline at end of file
import queue
pile = queue.LifoQueue()
for i in range(5): pile.put(i)
while not pile.empty():
print(pile.get(), end=" ")
# 4 3 2 1 0
\ No newline at end of file
from pile import *
p = Pile()
for d in data:
p.ajoute(d)
e = p.supprime()
print(e['nom'] + " " + e['prenom']) # Arthaud Nathalie
\ No newline at end of file
File deleted
File deleted
TD04/Image10.bmp

192 KiB

File deleted
TD05/palette-rainbow.png

1.58 KiB

TD05/rainbow.png

12.3 KiB

File deleted
a
à
abaissa
abaissable
abaissables
abaissai
abaissaient
abaissais
abaissait
abaissâmes
\ No newline at end of file
a
à
abaissa
abaissable
abaissables
abaissai
abaissaient
abaissais
abaissait
abaissâmes
abaissant
abaissante
abaissantes
abaissants
abaissas
abaissasse
abaissassent
abaissasses
abaissassiez
abaissassions
abaissât
abaissâtes
abaisse
abaissé
abaissée
abaissées
abaisse-langue
abaissement
abaissements
abaissent
abaisser
abaissera
abaisserai
abaisseraient
abaisserais
abaisserait
abaisseras
abaissèrent
abaisserez
abaisseriez
abaisserions
abaisserons
abaisseront
abaisses
abaissés
abaisseur
abaisseurs
abaissez
abaissiez
abaissions
abaissons
abajoue
abajoues
abandon
abandonna
abandonnai
abandonnaient
abandonnais
abandonnait
abandonnâmes
abandonnant
abandonnas
abandonnasse
abandonnassent
abandonnasses
abandonnassiez
abandonnassions
abandonnât
abandonnataire
abandonnataires
abandonnâtes
abandonne
abandonné
abandonnée
abandonnées
abandonnent
abandonner
abandonnera
abandonnerai
abandonneraient
abandonnerais
abandonnerait
abandonneras
abandonnèrent
abandonnerez
abandonneriez
abandonnerions
abandonnerons
abandonneront
abandonnes
abandonnés
abandonnez
abandonniez
abandonnions
abandonnons
abandons
abaque
abaques
abasourdi
abasourdie
\ No newline at end of file
This diff is collapsed.
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment