def update_parameters(params, grads, alpha):
    """
    Updates model parameters using gradient descent.

    Arguments:
        params -- dictionary containing model parameters
        grads -- dictionary with gradients, output of L_model_backward()

    Returns:
        params -- dictionary with updated parameters
            params['w' + str(l)] = ...
            params['b' + str(l)] = ...
    """
    n_layers = len(params) // 2
    for i in range(n_layers):
        params['w%s' % (i+1)] = (
                params['w%s' % (i+1)] - alpha * grads['dw%s' % (i+1)])
        params['b%s' % (i+1)] = (
                params['b%s' % (i+1)] - alpha * grads['db%s' % (i+1)])
    return params