I want to change 'A' by 'An' if needed. I managed to do so, but I think there is a shorter way.
Replace this line with your 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.) continue if f=='a' or f=='e' or f=='i' or f=='o' or f=='u': print 'An', f else: print 'A', f else: print 'A fine selection of fruits!'