我如何在python中通过引用调用

时间:2017-06-14 14:00:55

标签: python

我已经写了他的c代码:

 void cautare_element_liber(int *linie,int *coloana)
{
                                                        //Cauta un element liber in matrice transmitand linia si coloana acestuia
    *linie=0;
    *coloana=0;
    int i,j,ok=0;
    for(i=1;i<=9 && ok==0;i++)
        for(j=1;j<=9&& ok==0;j++)
        if(a[i][j] == 0 )
        {
        *linie = i;
        *coloana=j;
        ok=1;
        }
}
    cautare_element_liber(&linie,&coloana);

在python中它在cautare_element_liber(linie,coloana)给我一个错误

def cautareElementLiber(linie, coloana):
    linie = 0
    coloana = 0
    ok = 0
    for iIterator in range(1, 10) and ok == 0:
        for jIterator in range(1, 10) and ok == 0:
            if a[iIterator][jIterator] == 0:
                linie = i
                coloana = jIterator
                ok = 1

cautareElementLiber(linie, coloana)

&#34; LINIE&#34;未定义

0 个答案:

没有答案