Answer:
Following are the program in the Python Programming Language:
def sort_by_product(products): #define function
products.sort(key=lambda x: x[4] * x[1]) #solution is here
return products #return products
#set list type variable
product = [
[1, 2, 9, 1, 1, 2],
[1, 7, 9, 9, 7, 2],
[1, 1, 9, 5, 2, 2],
[1, 5, 9, 4, 6, 2],
]
sort_by_product(product) #call function
print(product) #print result
Step-by-step explanation:
Here, we define function "sort_by_product" and pass an argument inside it.
- inside the function we sort the list and writr the following solution in it.
- we return the value of products
Then, we set the list type variable 'product' then, call the function.