neosapien header image

Tuesday, May 27, 2008

Python regexp quiz for geeks

What does blackbox function return?

import re
def blackbox(num):
  return not re.match(r"^1?$|^(11+?)\1+$", "1"*num)

0
said thank you for this page

Liked this article? Bookmark/share it with others: Didn't like the article, found a mistake or just want to express your own opinion? Post a comment!

0 comments:

Post a Comment

Have anything to say? Leave a comment!
Too shy or got a too private question? Email me
Alternatively, you can drop me a line on Twitter