Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def find(char, string):
- """Return the first i such that string[i] == char
- find(str, str) -> int
- If char does not occur in string then -1 is returned.
- """
- i = 0
- length = len(string)
- while i < length:
- if char == string[i]:
- return i
- i += 1
- return -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement