This returns a if "a" in, or -1 if using "z":

class zoeken() :
        pass
        def __len__(self):
                return 0
        def __str__(self):
                return test2
        def find(self, strng, ch, start, stop):
                index = start
                while index < len(strng) and index < stop:
                        if strng[index] == ch:
                                return ch
                        index += 1
                        return -1


test = zoeken()
test.woord = "tamara"
stop = len(test.woord)
test2 = test.find(test.woord, "a", 1,stop)
print test2

David
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to