Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def cartesianProduct(setA, setB):
if len(setA) == 0:
return None
if len(setB) == 0:
return None
product = []
for elementA in setA:
for elementB in setB:
product.append([elementA, elementB])
return product
print(cartesianProduct(['a', 'b'], ['1', '2', '3']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.