.
This commit is contained in:
27
bac1/q1/27oct/ex6.py
Normal file
27
bac1/q1/27oct/ex6.py
Normal file
@ -0,0 +1,27 @@
|
||||
def peut_retirer(i, bag, jeu):
|
||||
"""verifie si une baguette peut etre retiree """
|
||||
on_top = bag[:]
|
||||
for intersection in jeu:
|
||||
if intersection[1] in on_top:
|
||||
on_top.remove(intersection[1])
|
||||
return i in on_top
|
||||
|
||||
|
||||
def retirer(i, bag, jeu):
|
||||
bag.remove(i)
|
||||
for intersection in jeu:
|
||||
if i in intersection:
|
||||
jeu.remove(intersection)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from ex5 import creer_mikado
|
||||
|
||||
bag = list(range(10))
|
||||
game = creer_mikado(bag)
|
||||
print(game)
|
||||
retirer(5, bag, game)
|
||||
print(game)
|
||||
# print(bag)
|
||||
# print(game)
|
||||
# print(peut_retirer(5, bag, game))
|
Reference in New Issue
Block a user