"""=========================
exercise 8.4
========================="""
def find(word, letter, start):
index = start
while index < len(word):
if word[index] == letter:
return index
index = index + 1
return -1
print find('stirring','i',0)
print find('stirring','i',2)
print find('stirring','i',3)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.