Merge branch 'master' of githubu:GeoffreyFrogeye/tp-info
This commit is contained in:
commit
98ea39de32
|
@ -425,16 +425,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