I am new to programming and python.I've written a simple python program that iterates through a list of fruits and stops when it encounters the fruit 'Banana'
.
fruits = ['Orange', 'Mango', 'Grapes', 'Guava','Blue Berry', 'Litchie', 'Banana',
'Cherry', 'Strawberries', 'Pears', 'Apple']
for x in fruits:
if x is "Banana"
print('Here is %s',x)
break
else
print(x)
The above script fails with invalid syntax. I tried different options such as x == 'Banana'
: but the same error message is displayed. What's wrong here?