Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41662
| Date | 2013-03-21 15:48 -0400 |
|---|---|
| From | Dave Angel <davea@davea.name> |
| Subject | Re: problem with function |
| References | <870147F2-AF34-456A-BDF3-12C0A2F67A69@icloud.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3596.1363895324.2939.python-list@python.org> (permalink) |
On 03/21/2013 02:31 PM, leonardo selmi 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? > If I run it, I get nothing at all, since there's no call to find()). And when I add lines that print the results of calling the function, I get reasonable results. How about if you do the following: 1) tell us Python version and OS. 2) show us the whole code, copy/pasted into your message 3) show us the whole error message (traceback), copy/pasted into your message And if you're running it from somewhere other than a terminal window, tell us how you're running it. Or better, run it from a terminal, and show us the whole sequence, by copy/pasting from the terminal to the message. -- DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: problem with function Dave Angel <davea@davea.name> - 2013-03-21 15:48 -0400
csiph-web