Stedents Question

Geert-Jan Van den Bogaerde gvdbogae at vub.ac.be
Fri Mar 1 19:12:14 EST 2002


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"

Geert-Jan






More information about the Python-list mailing list