having troubles wiht python syntax especially on a if check

 for i in range(len(nestedlist)):
     if nestedlist[i][-1]=!0:
         print(str(nestedlist)[i][0])+" "+str(nestedlist)[i][-1]))

This code works, the if is the thing that ruins this can some one help?

Upvotes: 0

Views: 32

Answers (2)

PacketLoss
PacketLoss

Reputation: 5746

=! is not a valid operator You need to update =! to !=

test = 1
test1 = 2
test =! test1
SyntaxError: invalid syntax
test != test1
True

Upvotes: 2

William Herewini
William Herewini

Reputation: 199

The inequality syntax is wrong, it should be != rather than =!

Upvotes: 1

Related Questions