list=[1,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,1,0,1,3,0,3,0,3,1]
so now i want to know if the 5th object in this list is 3:
if list.index(3)==5:
print("yes")
else:
print("no")
-> answer is "no"... but it is, as you see. So how can i solve it?
nois in the local namespace :P -- e.g. ifno = "Hello World"before getting here, it would work on python2 or python3print list[5-1]==3and the mass is over. The -1 is due to the fact that first element is indexed 0.print ('NO','YES')[list[4]==3]. Orprint 'YES' if list[4]==3 else 'NO'