Following is my code:
def find_first_occurance(s, c, start=0, end=len(s) ):
while start<end:
if s[start] ==c: # whether they are the same or not
return start
else:
start+=1
return -1
print(find_first_occurance("the days make us happy make us wise","s"))
I got an error, name "s" is not defined
.
I kind of understand what is going on. While on the other hand, it would be so nice if this feature was allowed in Python, right?
What do you think? Or did I miss something here?