I spent hours on this. My understanding - both if loop should do same thing. But one under comment is giving "Timeout error" in codewar while the other one is working fine.
What am I missing?
This is giving timeout error
'''
-----
why the hell this code is not working for if loop???
-----
if ins[1] in result:
if result[ins[1]] != 0:
i += int(ins[2])
elif int(ins[1]) != 0:
i += int(ins[2])
else:
i += 1
'''
Below code is working fine
if ( result[ins[1]] if ins[1] in result else int(ins[1]) ):
i += int(ins[2])
else:
i +=1
Aucun commentaire:
Enregistrer un commentaire