0

I have two lists:

A =  ["a", "b", "c"]
B = ["H", "N"]

How to append values from second list to first, if I need to get this:

C = [["a","H"], ["a","N"], ["b", "H"], ["b", "N"], ["c", "H"], ["c", "N"]]
cs95
  • 379,657
  • 97
  • 704
  • 746
Olga
  • 101
  • 1
  • 8

1 Answers1

0
import itertools

A = ["a", "b", "c"]
B = ["H", "N"]

print list(itertools.product(A, B))
# [('a', 'H'), ('a', 'N'), ('b', 'H'), ('b', 'N'), ('c', 'H'), ('c', 'N')]
Ghilas BELHADJ
  • 13,412
  • 10
  • 59
  • 99