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

Init

parent 7cbe6d9c
No related branches found
No related tags found
No related merge requests found
.DS_Store
nom;prenom;filiere;moyenne;absences
Dupond;Pierre;MP;19;0
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(l)
print(data)
\ No newline at end of file
#%%
import time
import random
import matplotlib.pyplot as plt
import numpy as np
#%matplotlib inline
nvalues = [100, 500, 1000, 1500, 2000, 2500, 3000]
timesEtudiants1 = []
for i in nvalues:
random.seed()
p = 12**2 # Ordre de grandeur des valeurs
liste = []
for x in range(i): liste.append(random.randint(0, p))
a=time.perf_counter()
e1 = []
for n in liste:
e1.append(n)
b=time.perf_counter()
timesEtudiants1.append(b-a)
plt.plot(nvalues,timesEtudiants1, "r-", label="Etudiants 1")
plt.title("Comparaison des performances")
# %%
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
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment