#sample solution
fruits = ['banana', 'apple', 'orange', 'tomato', 'pear', 'grape']
print 'You have...'
for f in fruits:
if f == 'Tomato': #capitalize tomato
print 'A tomato is not a fruit!'
break
elif f[0] == "a" or f[0] == "e" or f[0] == "i" or f[0] == "o" or f[0] == "u":
print 'an', f
else:
print 'a', f
else:
print 'A fine selection of fruits!'
fruits = ['banana', 'apple', 'orange', 'tomato', 'pear', 'grape']
print 'You have...'
for f in fruits:
if f == 'Tomato': #capitalize tomato
print 'A tomato is not a fruit!'
break
elif f[0] == "a" or f[0] == "e" or f[0] == "i" or f[0] == "o" or f[0] == "u":
print 'an', f
else:
print 'a', f
else:
print 'A fine selection of fruits!'
No comments:
Post a Comment