Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Examen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BAHOU Mehdi
Examen
Commits
3a075624
Commit
3a075624
authored
5 months ago
by
BAHOU Mehdi
Browse files
Options
Downloads
Patches
Plain Diff
Question 10
parent
8d88a74e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examen.py
+16
-1
16 additions, 1 deletion
examen.py
with
16 additions
and
1 deletion
examen.py
+
16
−
1
View file @
3a075624
...
@@ -73,7 +73,12 @@ class TabletteChocolat:
...
@@ -73,7 +73,12 @@ class TabletteChocolat:
plt
.
show
()
plt
.
show
()
plt
.
close
()
plt
.
close
()
def
demander_coup
(
self
):
def
demander_coup
(
self
):
if
(
self
.
m
,
self
.
n
)
!=
(
1
,
1
):
demande
=
input
(
'
Couper des lignes (l) ou colonnes (c) ?
'
)
demande
=
input
(
'
Couper des lignes (l) ou colonnes (c) ?
'
)
elif
self
.
m
==
1
and
self
.
n
>
1
:
demande
=
input
(
'
Couper des colonnes (c) ?
'
)
elif
self
.
n
==
1
and
self
.
m
>
1
:
demande
=
input
(
'
Couper des lignes (l) ?
'
)
if
demande
==
'
l
'
:
if
demande
==
'
l
'
:
while
(
True
):
while
(
True
):
reponse
=
int
(
input
(
"
Combien ? En sachant qu
'
il y a
"
+
str
(
self
.
m
-
1
)
+
"
possibilités
"
))
reponse
=
int
(
input
(
"
Combien ? En sachant qu
'
il y a
"
+
str
(
self
.
m
-
1
)
+
"
possibilités
"
))
...
@@ -88,6 +93,15 @@ class TabletteChocolat:
...
@@ -88,6 +93,15 @@ class TabletteChocolat:
return
(
0
,
reponse
)
return
(
0
,
reponse
)
else
:
else
:
print
(
'
coup non valide
'
)
print
(
'
coup non valide
'
)
def
jouer
(
m
,
n
):
Tablette
=
TabletteChocolat
(
m
,
n
)
while
(
Tablette
.
m
,
Tablette
.
n
)
!=
(
1
,
1
):
Tablette
.
plot
()
X
=
Tablette
.
demander_coup
()
Tablette
=
Tablette
.
coupe
(
X
[
0
],
X
[
1
])
Tablette
.
plot
()
#Programme Principal
#Programme Principal
Tablette
=
TabletteChocolat
(
4
,
3
)
Tablette
=
TabletteChocolat
(
4
,
3
)
...
@@ -96,3 +110,4 @@ g= Tablette.coups_possibles()
...
@@ -96,3 +110,4 @@ g= Tablette.coups_possibles()
print
(
list
(
g
))
print
(
list
(
g
))
print
(
Tablette
.
est_possible
(
1
,
0
))
print
(
Tablette
.
est_possible
(
1
,
0
))
biscuit
=
Tablette
.
coupe
(
1
,
0
)
biscuit
=
Tablette
.
coupe
(
1
,
0
)
jouer
(
4
,
3
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment