-1

Let's assume that we have 6 strings:

Input: ["Love", "Is", "What", "I", "Care", "About"]

Then what can I do to find all combination of words for the output to be like:

Love Is What I Care About

Love Is What I About Care

About Care I What Is Love

And so on with no repetition


I'm new to this, hope you guys can help me.

Many Thanksss

Light
  • 19

1 Answers1

1
>>> import itertools
>>> inputs = ["Love", "Is", "What", "I", "Care", "About"]
>>> list(itertools.permutations(inputs, len(inputs)))
mahieyin-rahmun
  • 1,486
  • 1
  • 12
  • 20
  • Please do not do the homework for other SO Users. They will not learn anything from it except ask the next homework question here. – Jens Aug 28 '22 at 14:58
  • Do not post code only. Add also an explanation – Jens Aug 28 '22 at 14:59