Functions Function to Create Cartesian Product of two Lists in Python || Type 1 || Functions || Python

In this we are going to see how to build a function to Create Cartesian Product of two Lists in Python - Type 1 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))
    print(list3)


cartesian_product()

# Coded By DHIRAJ SHELKE

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post