'''
example 7.1 page no : 69
'''
fruit = "banana"
index = 0
while(index < len(fruit)):
letter = fruit[index]
print letter
index = index + 1
'''
example 7.2 page no :71
'''
def find(s,c,i):
while (i<len(s)):
if (s[i] == c): return i
i = i + 1
return -1;
print find("banana",'b',0)
print find("banana",'b',3)
'''
example 7.3 page no : 71
'''
fruit = "banana"
length = len(fruit)
count = 0
index = 0
while (index < length):
if (fruit[index] == 'a'):
count = count + 1
index = index + 1
print count
'''
example 7.4 page no : 72
'''
fruit = "banana";
bakedGood = " nut bread";
dessert = fruit + bakedGood;
print dessert
'''
example 7.5 page no :73
'''
suffix = "ack"
letter = 'J'
while (letter <= 'Q'):
print letter + suffix
c = ord(letter) + 1
letter = chr(c)
'''
example 7.6 page no :74
'''
word = "Zebra"
if (word < "banana"):
print "Your word, " , word , ", comes before banana."
elif (word > "banana"):
print "Your word, " , word , ", comes after banana."
else:
print "Yes, we have no bananas!"
a = 'a'
print a.upper()