Complete the code to import the linear programming function from scipy.
from scipy.optimize import [1] result = linprog(c=[-1, 4], A_ub=[[2, 1], [1, 2]], b_ub=[20, 20])
The function linprog is used for linear programming in scipy.optimize.
Complete the code to define the objective function coefficients for minimization.
c = [1] result = linprog(c, A_ub=[[1, 2], [3, 1]], b_ub=[4, 3])
The coefficients c define the objective function to minimize. Negative values can represent maximization by minimizing the negative.
Fix the error in the code by completing the missing inequality matrix.
A_ub = [1] result = linprog(c=[-1, 4], A_ub=A_ub, b_ub=[20, 20])
The matrix A_ub defines the coefficients for inequality constraints. The correct matrix matches the problem constraints.
Fill both blanks to create a dictionary comprehension that maps words to their lengths if length is greater than 3.
words = ['data', 'ai', 'science', 'ml'] lengths = { [1] : [2] for word in words if len(word) > 3 }
The dictionary comprehension uses the word as key and its length as value.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths if length is greater than 3.
words = ['data', 'ai', 'science', 'ml'] lengths = { [1] : [2] for word in words if len(word) [3] 3 }
The dictionary comprehension maps the uppercase word to its length, filtering words longer than 3 characters.