简体   繁体   中英

I am having a syntax error executing some python code [on hold]

So the problem is that I am having a sintax error in the "if" line of code. I am pretty new to python, so I am not understanding what's happening here.

            for d in dataset: #Percorre todo o dataset
               countTotal = countTotal + 1  #Contar todos os tuplos por atributo
                #Caso os valores do ciclo sejam iguais aos valores do d
               if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx
                  count = count + 1
            thisdict[(valA,valC)] = count
            valClass_idx = valClass_idx + 1

You forgot to add ":" in this statement

if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx

It should be:

if d.x[att_idx] == valAtt_idx and d.y[0] == valClass_idx:

So, it was missing a ":" after the if statement: )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM