[Tutor] strings

Lloyd Kvam pythontutor at venix.com
Tue Dec 9 14:21:52 EST 2003


Sounds like homework...

Let me just suggest a plausible definition for
"index of first occurrence of character".
The index is a count of the characters before the character you are
trying to locate.  If your character is the very first character of the
string, then (from the definition) the index is 0.

Hope this helps.

trypticon at SAFe-mail.net wrote:

> Hi,
>      i'm having a little trouble with this exercise problem. We're supposed to create a function called findchr(string,char) which will look for character char in string and return the index of the first occurrence of char, or -1 if char is not part of string. you can't use string.*find() or string.*index() functions or methods. The part where i'm having trouble is returning the index of the first occurrence of char. Any help would be appreciated. Thanks
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582




More information about the Tutor mailing list