-1

I have 4 lists:

city = ['ROMA', 'ROMA', 'ROMA', 'PARIGI', 'PARIGI', 'CAIRO', 'MOSCA', 'BERLINO', 'CANCUN', 'MILANO', 'PECHINO', 'PECHINO', 'ROMA', 'PARIGI', 'MILANO', 'ROMA', 'MOSCA', 'CAIRO', 'PARIGI', 'PARIGI', 'BERLINO', 'CANCUN', 'PECHINO']

clues = ['la', 'la', 'la', 'bocca', 'bocca', 'bocca', 'bocca', 'sollevò', 'sollevò', 'sollevò', 'sollevò', 'dal', 'dal', 'dal', 'dal', 'fiero', 'fiero', 'fiero', 'fiero', 'pasto', 'pasto', 'pasto', 'pasto']

destinations = ['PARIGI', 'CAIRO', 'MOSCA', 'BERLINO', 'CANCUN', 'MILANO', 'PECHINO', 'PECHINO', 'ROMA', 'PARIGI', 'MILANO', 'ROMA', 'MOSCA', 'CAIRO', 'PARIGI', 'PARIGI', 'BERLINO', 'CANCUN', 'PECHINO', 'CANCUN', 'CANCUN', 'MILANO', 'MILANO']

secrets = ['vendita', 'furto', 'mata', 'diamanti', 'cannoni', 'di', 'hari', 'rubati', 'mercato', 'diamanti', 'ha', 'stanotte', 'nero', 'a', 'sedotto', 'ad', 'del', 'buckingham', 'ambasciatore', 'anversa', 'cairo', 'palace', 'zambia']

And a list that is

[‘la’, ‘bocca’, ‘sollevó’, ‘dal’, ‘fiero’, ‘pasto’]

Is there a way to get the combinations from the secrets list that are:

  • vendita diamanti rubati stanotte ad anversa

  • vendita cannoni mercato nero del cairo

  • furto di diamanti a buckingham palace

  • mata hari ha sedotto ambasciatore zambia

I have the starting city and it is ROMA, so I have to move on PARIGI, but since there are 2 PARIGI. I don't understand how I can handle the second path.

Is there a way to get those solutions without using trees?

Those are all paths that i have to find [1]: https://i.stack.imgur.com/jaL5K.jpg

Tommyso
  • 1
  • 3

1 Answers1

0

My Solution is: Everytime i find a Solution, i remove the elements of the index in the 4 lists, but it will except a Solution If fact, my Solution will print:

vendita diamanti rubati stanotte ad anversa

furto di diamanti a buckingham palace

mata hari ha sedotto ambasciatore zambia

And ignores this one:

vendita cannoni mercato nero del cairo

I also created a dictionary that has the first city as key(“ROMA”) and his childrens(“PARIGI”,”CAIRO”,”MOSCA”) as values. Same for “PARIGI”:[“BERLINO”,”CANCUN”] But could be useful?

Tommyso
  • 1
  • 3