0
mylist = [['apple',1],['banana',2],['byrne',3]]
x =  0
for y in mylist:
    print(x)
    print(mylist[x][0])
    if 'byrne' or 'apple' == mylist[x][0]:
        print('hi')
    x += 1

prints out:

0 apple hi 1 banana hi 2 byrne hi

The question: why does it enter the if loop for x = 1?

If i put just one string for entering the loop i get one hi, as expected.

NiceIce
  • 1
  • 1

0 Answers0