Just a question: Why does it executes the print 'A', f first, in stead of first going through all the list and comparing if A is a tomato (A==tomato)?
In way I expected this to happen:
A tomato is not a fruit!
And the break would prevent the following to print:
fruits = ['banana', 'apple', 'orange', 'tomato', 'pear', 'grape'] print 'You have...' for f in fruits: if f == 'tomato': print 'A tomato is not a fruit!' # (It actually is.) break print 'A', f else: print 'A fine selection of fruits!'