I have a 2d list and a class to get users input and compare that object to what is stored.
For testing purposes it prints the coordinate and its equal to A but it ignores the if statement by not adding to the count.
Why is it ignoring the if statement
this is my current code
count =0
print self.object[row][col]
if self.object[row][col] == "A":
count +=1
print count
I know nothing about the type of
self.object[row][col]and type matters, as clearly visible below:Thus, by guessing, you can try the following comparisons, converting your variable into appropriate type before comparison:
converting to string:
converting to integer:
Let me know if it helped.