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