Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List1 = ["a", "b"]
- List2 = ["c", "d"]
- # if you want the concatenate the two strings
- List3 = [i+j for i in List1 for j in List2]
- # if you want to make tuples out of the objects
- List4 = [(i, j) for i in List1 for j in List2]
- # the itertools module has functions for a lot of combinatorics operations
- import itertools
- List5 = list(itertools.product(List1, List2))
- print(List3)
- print(List4)
- print(List5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement