# 18 change it up


I've looked at the forum, I played with indentations, what am I missing please?

Oops, try again. It looks like your code is not executing its else statement.

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.)
    elif f != 'tomato':
        print 'A', f
    print 'A fine selection of fruits!'


I believe we could just use else: here and not have a condition.


it's funny how when it is posted elsewhere, it becomes clearer.
I took out the break and it worked.:smiley_cat:


That is not what we need to do, though. The break should stay. The trick is to change the conditional to something that is not a fruit (or more specifically, not in the list).

if f == 'potato':


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.