LinearExpression.__getitem__

LinearExpression.__getitem__(i)[source]

Returns the i-th coefficient where i can be a variable name or index.

Parameters

i (Union[int, str]) – the index or name of the variable corresponding to the coefficient.

Return type

float

Returns

The coefficient corresponding to the addressed variable.