min() arg is an empty sequence

前端 未结 4 1202
逝去的感伤
逝去的感伤 2021-02-20 07:32

I\'m trying to find minimum element in matrix row, but there are two conditions: 1) it must be > 0 2) and this point must be not visited(is_visited[k] is False) I\'

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-20 08:03

    Just use and operation for concatenate tow if statement :

    min(x for x in matr_sum[i] if x > 0 and if is_visited[k] is False and i!=k)
    

提交回复
热议问题