puzzle/joke ;-)

Volucris volucris at hotmail.com
Fri May 4 03:09:45 EDT 2001


"Roman Suzi" <rnd at onego.ru> wrote in message
news:mailman.988904826.31968.python-list at python.org...
>
> What is the shortest Python operator to output this:
>
>
'\'\\\'\\\\\\\'\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\
\\\
>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'"\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\
>
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\
>
\\\\\\\\\\\\\\\\\\'"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\
> \\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\'\\\\\\\'\\\'\''
>
> (for the purposes of illustration, newlines are inserted. Original
> string was without them:
>
>
'\'\\\'\\\\\\\'\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'"\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\'\\\\\\\
'\\\'\''
>
>
> Sincerely yours, Roman Suzi
> --
> _/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
> _/ Thursday, May 03, 2001 _/ Powered by Linux RedHat 6.2 _/
> _/ "A conclusion is simply the place where you got tired of thinking." _/
>

def blip():
    blop = '\'\"' + '\\'*129 + '\'\"'
    for x in range(6, 0, -1):
        if x == 6:
            offset = 0
        else:
            offset = 1
        seq = (2**(x)-offset)*'\\'
        blop = '\'' + seq + blop + seq + '\''
    return blop + '\''

This gives the right output. But it's ugly and I work in 4 hours. Good
NIGHT!

greg





More information about the Python-list mailing list