Ad

You have to create a function that given an array of integers returns the largest product that can be made by multiplying any 3 integers in the array.

Example:

[-4, -4, 2, 8] should return 128 as the largest product can be made by multiplying -4 * -4 * 8 = 128.

def maximum_product_of_three(lst):

    max_pr = 0
    num_num = 0

    for num in lst:
        for i in range(0,len(lst)):
            if i != lst[num_num] and num_num+2 < len(lst):
                try:
                    if (num*lst[i+1]*lst[i+2])>max_pr:
                        max_num = num*lst[i+1]*lst[i+2]
                except:
                    pass
        num_num =+ 1

    return max_num