TP2 Avancement Annagrammes phrases
This commit is contained in:
parent
7f7cbd20a7
commit
9a0a5789f3
|
@ -362,20 +362,22 @@ partie('Phrases d\'anagrammes') # Geoffrey
|
|||
|
||||
question(1)
|
||||
|
||||
def annagrammes_liste(liste):
|
||||
res = []
|
||||
premierAnagrammes = anagrammes(liste[0]):
|
||||
|
||||
def annagrammes_arbre(liste):
|
||||
# TODO Docstring
|
||||
premierAnagrammes = anagrammes(liste[0])
|
||||
if len(liste) > 1: # Si il y a des anagrammes après
|
||||
res = []
|
||||
for i in premierAnagrammes:
|
||||
res.append([i, annagrammes_liste(liste[1:])])
|
||||
return res
|
||||
else:
|
||||
return premierAnagrammes
|
||||
|
||||
|
||||
def annagrammes_phrase(phrase):
|
||||
# TODO Docstring
|
||||
phraseAnagrammes = []
|
||||
mots = phrase.split()
|
||||
motsAnagrammes = {m: annagrammes(m) for m in set(mots)}
|
||||
for m in range(len(mots)):
|
||||
|
||||
|
||||
|
||||
phraseAnagrammes = annagrammes_arbre(phrase.split())
|
||||
return phraseAnagrammes # DEBUG
|
||||
|
||||
print(annagrammes_phrase('onomatopée dactylographie')) # DEBUG
|
||||
|
|
Reference in a new issue