Â
In this we are going to see how to build a function to Create Cartesian Product of two Lists in Python - Type 2 of Functions in Python Programming Language.
def cartesian_product():
for i in list1:
for j in list2:
list3.append((i, j))
print(list3)
list1 = [1, 2, 3]
list2 = [4, 5, 6]
list3 = []
cartesian_product()
# Coded By Ashish
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP