1 | initial version |
I know this is more a Python question. Here is my answer :
def pos_rat(x,y,sw) :
if y>0:
return x/y
else :
if sw == 1:
return "-"
elif sw == 2 :
return -100000
def ratio_for_pivot(mat, var_ent, sw):
a=[pos_rat(mat[i][mat.ncols()-1],mat[i][var_ent],sw) for i in range(mat.nrows()-1)]
return a
2 | No.2 Revision |
I know this is more a Python question. Here is my answer :answer:
def pos_rat(x,y,sw) :
pos_rat(x, y, sw):
if y>0:
y > 0:
return x/y
else :
else:
if sw == 1:
return "-"
elif sw == 2 :
2:
return -100000
def ratio_for_pivot(mat, var_ent, sw):
a=[pos_rat(mat[i][mat.ncols()-1],mat[i][var_ent],sw) a = [pos_rat(mat[i][mat.ncols() - 1], mat[i][var_ent], sw)
for i in range(mat.nrows()-1)]
range(mat.nrows() - 1)]
return a