Skip to content
Snippets Groups Projects
Commit 59878469 authored by BAHOU Mehdi's avatar BAHOU Mehdi
Browse files

Question 8

parent c935c2d2
No related branches found
No related tags found
No related merge requests found
......@@ -59,20 +59,27 @@ class TabletteChocolat:
def plot(self):
m=self.m
n=self.n
plt.fill([0,m,m,0,0],[0,0,n,n,0], color='#D5B799')
plt.fill([0,0,n,n,0],[0,m,m,0,0], color='#D5B799')
for i in range(m):
for j in range(n):
X = [i+0.1, i+0.1, i+0.9, i+0.9, i+0.1]
Y = [j+0.1, j+0.9, j+0.9, j+0.1, j+0.1]
X = [j+0.1, j+0.9, j+0.9, j+0.1, j+0.1]
Y = [i+0.1, i+0.1, i+0.9, i+0.9, i+0.1]
plt.plot(X,Y, color='#000')
n = 0
m -=1
plt.fill([m+0.1, m+0.1, m+0.9, m+0.9, m+0.1], [n+0.1, n+0.9, n+0.9, n+0.1, n+0.1], color='#000')
m =0
n -= 1
plt.fill([n+0.1, n+0.9, n+0.9, n+0.1, n+0.1], [m+0.1, m+0.1, m+0.9, m+0.9, m+0.1], color='#000')
plt.gca().set_aspect('equal')
plt.axis('off')
plt.show()
plt.close()
def demander_coup(self):
demande = input('Couper des lignes (l) ou colonnes (c) ?')
if demande == 'l':
reponse = int(input("Combien ? En sachant qu'il y a " + str(self.m-1) +" possibilités"))
return (reponse,0)
elif demande == 'c':
reponse = int(input("Combien ? En sachant qu'il y a "+ str(self.n - 1)+ " possibilités"))
return (0, reponse)
#Programme Principal
......@@ -83,3 +90,4 @@ print(list(g))
print(Tablette.est_possible(1,0))
biscuit = Tablette.coupe(1,0)
Tablette.plot()
print(Tablette.demander_coup())
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment