HackerRank Python - itertools.product




You are given two lists and A and B. Your task is to compute their cartesian product AXB.



  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. from itertools import product
  3. a = list(map(int, input().split()))
  4. b = list(map(int, input().split()))
  5. print(*product(a, b))




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube