Skip to content
Extraits de code Groupes Projets
Valider d6451f23 rédigé par fbury's avatar fbury
Parcourir les fichiers

Added vertical drawing of ex2

parent a515ebb3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -67,7 +67,7 @@ class Histogram:
print ('-' * width + '> y')
# Draw bin by bin #
for ibin,bin_content in enumerate(scaled_data):
line = f'{ibin:3d}|'
line = f'{ibin+1:3d}|'
for y in range(width):
if bin_content>= y:
line += "#"
......@@ -95,8 +95,3 @@ if __name__=="__main__":
#h.draw()
h.drawT()
h2 = Histogram(50,-5,5)
from random import gauss
for i in range(int(1000000)):
h2.fill(gauss(0,1))
h2.drawT()
import random
from Histogram import Histogram
N = 100000
# Dice throw #
h1 = Histogram(6,1,7)
for i in range(N):
h1.fill(random.randint(1,6))
h1.drawT()
# Gaussian #
h2 = Histogram(50,-5,5)
from random import gauss
for i in range(int(N)):
h2.fill(gauss(0,1))
h2.drawT()
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter