-2

Suppose I have two lists.

noun=["Whispers", "Loners", "Gamblers"]
adj=["Shining", " Moaning"]

And I want to print:

The Shining Whispers
The Shining Loners
The Shining Gamblers
The Moaning Whispers
The Moaning Loners
The Moaning Gamblers

What should be my code to do this? These ones are small lists. I have bigger lists. So what code should I write to accomplish this?

martineau
  • 119,623
  • 25
  • 170
  • 301
  • https://stackoverflow.com/a/34032549/701049 – tim Apr 28 '18 at 16:44
  • 2
    this is not a duplicate of "combinations between two lists" just because there is an answer to that question that satisfies *this* one. – Niklas R Apr 28 '18 at 16:53
  • Lol! Than I'll create another question which asks to print it workout the "the" in front of the combination. hope it gets answers instead of being marked as duplicate – tim Apr 28 '18 at 16:59
  • I didn't understand the zip.[list] blah blah shit, so asked this. – Rohit Kundu Apr 29 '18 at 02:26

1 Answers1

2
for a, b in itertools.product(noun, adj):
  print('The', a, b)
Niklas R
  • 16,299
  • 28
  • 108
  • 203