18.Change it up


#1



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

here is my codes:

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
else:
print_fruits



#2

Hi, @sooroush ,

Be sure to format code any time you post it, so we can see important details such as indentation and underscores that may not be visible if the code is unformatted. See How do I format code in my posts?.

What happened to the following statement, which was within the else block in the default code? ...

print 'A fine selection of fruits!'

#3

Thanks a lot friend
remove elife line, and it\s work

here is the pass code:

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.)
else:
print 'A fine selection of fruits!'


#4

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