thank you all
Il giorno 22/mar/2013, alle ore 00:20, Terry Reedy ha
scritto:
> On 3/21/2013 2:31 PM, leonardo selmi wrote:
>
>> i wrote the following code:
>>
>> def find(word, letter):
>> index = 0
>> while index < len(word):
>> if word[index] == letter:
>> ret
On 3/21/2013 2:31 PM, leonardo selmi wrote:
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
Since this is a learning exercise, consider the f
On Mar 21, 2013 1:35 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
>
More efficient:
def
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 '
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: n
On Fri, Mar 22, 2013 at 5:31 AM, 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 pr
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?
than