Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41659

problem with function

From leonardo selmi <l.selmi@icloud.com>
Subject problem with function
Date 2013-03-21 19:31 +0100
Newsgroups comp.lang.python
Message-ID <mailman.3594.1363894319.2939.python-list@python.org> (permalink)

Show all headers | View raw


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?

thanks!

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

problem with function leonardo selmi <l.selmi@icloud.com> - 2013-03-21 19:31 +0100
  Re: problem with function "Alex" <foo@email.invalid> - 2013-03-21 20:11 +0000

csiph-web