lamiastella

product

May 31st, 2016
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. from itertools import product
  2. list1 = list(input())
  3. list2 = list(input())
  4. result = product(list1, list2)
  5. for item in result:
  6.     print(item, end=" ")
  7.  
  8. /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /Users/mona/PycharmProjects/PythonCodes/cartesian_product.py
  9. 2 4
  10. 3 5
  11. ('2', '3') ('2', ' ') ('2', '5') (' ', '3') (' ', ' ') (' ', '5') ('4', '3') ('4', ' ') ('4', '5')
  12. Process finished with exit code 0
Advertisement
Add Comment
Please, Sign In to add comment