mirror of
https://github.com/Fare-spec/cours.git
synced 2025-12-08 03:00:37 +00:00
Auto urgent commit.
This commit is contained in:
@@ -66,8 +66,12 @@ def construire_chemins(graphe, depart):
|
|||||||
|
|
||||||
:effet de bord: Aucun
|
:effet de bord: Aucun
|
||||||
"""
|
"""
|
||||||
resultat = dict()
|
result = {
|
||||||
return resultat
|
depart: (0,None)
|
||||||
|
}# distance 0 et aucun truc avant
|
||||||
|
queue = [depart]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def reconstruire_chemin_vers(dico_chemins, *arrivee):
|
def reconstruire_chemin_vers(dico_chemins, *arrivee):
|
||||||
"""
|
"""
|
||||||
@@ -152,15 +156,14 @@ def produit_cartesien(*listes):
|
|||||||
>>> produit_cartesien([(1,2), (3, 4)], [(5, 6), (7, 8,)])
|
>>> produit_cartesien([(1,2), (3, 4)], [(5, 6), (7, 8,)])
|
||||||
[(1, 2, 5, 6), (1, 2, 7, 8), (3, 4, 5, 6), (3, 4, 7, 8)]
|
[(1, 2, 5, 6), (1, 2, 7, 8), (3, 4, 5, 6), (3, 4, 7, 8)]
|
||||||
"""
|
"""
|
||||||
if listes == 0:
|
if listes == None:
|
||||||
return []
|
return []
|
||||||
result = [()]
|
if len(listes) == 1:
|
||||||
for liste in listes:
|
return listes[0]
|
||||||
new_result = []
|
result = []
|
||||||
for tuples in result:
|
for elt in listes[0]:
|
||||||
for elt in liste:
|
for tuples in produit_cartesien(*listes[1:]):
|
||||||
new_result.append(elt + tuples)
|
result.append(elt + tuples)
|
||||||
result = new_result
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def creer_water_jug(*capacites):
|
def creer_water_jug(*capacites):
|
||||||
|
|||||||
5
graphes/leaudibidon/test.py
Normal file
5
graphes/leaudibidon/test.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
def produit_cartesien(*listes):
|
||||||
|
if listes == None:
|
||||||
|
return []
|
||||||
|
if len(listes) == 1:
|
||||||
|
return listes[0]
|
||||||
Reference in New Issue
Block a user