Loops in python:
fruits=['banana','apple','guava']
for fruit in fruits:
print 'Current Fruit:',fruit
print "Goodbye"
Output:
Current Fruit: banana Current Fruit: apple Current Fruit: guava print "Goodbye"
FOR Loop with index
fruits=['apple','mango','banana']
for index in range(len(fruits)):
print'current fruit:',fruits[index]
print 'goodbye!!'
Output:
current fruit: apple current fruit: mango current fruit: banana goodbye!!