On Fri, Mar 22, 2013 at 5:31 AM, leonardo selmi <l.se...@icloud.com> wrote: > hi all, > > i wrote the following code: > > def find(word, letter): > index = 0 > while index < len(word): > if word[index] == letter: > return index > index = index + 1 > return -1 > > if i run the program i get this error: name 'word' is not defined. how can i > solve it?
You'll need to post the whole code of your program. That function works fine for me. (Though it's somewhat unPythonic code, and in any case already exists in the standard library.) Tip: Look at the full traceback from the error. Chances are you'll find the cause of the error on one of the lines near the end of the trace. ChrisA -- http://mail.python.org/mailman/listinfo/python-list