Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41661 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2013-03-22 06:40 +1100 |
| Last post | 2013-03-22 06:40 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: problem with function Chris Angelico <rosuav@gmail.com> - 2013-03-22 06:40 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2013-03-22 06:40 +1100 |
| Subject | Re: problem with function |
| Message-ID | <mailman.3595.1363894837.2939.python-list@python.org> |
On Fri, Mar 22, 2013 at 5:31 AM, leonardo selmi <l.selmi@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
Back to top | Article view | comp.lang.python
csiph-web