Stedents Question
Geert-Jan Van den Bogaerde
gvdbogae at vub.ac.be
Mon Mar 4 17:25:20 EST 2002
On Mon, 2002-03-04 at 22:43, Jeff Shannon wrote:
>
>
> Geert-Jan Van den Bogaerde wrote:
>
> > On Sat, 2002-03-02 at 00:45, Tony K wrote:
> > > The question below is a tutorial question that stumps me. Any suggestions
> > > would be appreciated.
> > > Tony
> > >
> > > Write a Python function findABBC which takes a single string as parameter
> > > and returns all substrings thereof which match the regexp pattern ab+c. You
> > > are NOT allowed to use the re module.
> > >
> >
> > Haven't used regexps in a while, but I believe that just means:
> >
> > def findABBC(str):
> > return str == "a" + "b" * len(str[1:-1]) + "c"
>
> Except that the spec was to return all matching substrings. You're simply
> testing to see if the entire string matches that pattern, and returning a boolean
> true/false. (This could theoretically be used as a helper function in a
> solution, though I suspect that there's a better way to go about it.)
You are of course quite right. I misread the original question.
Geert-Jan
>
> Jeff Shannon
> Technician/Programmer
> Credit International
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list