librelist archives

« back to archive

Multi-line ask?

Multi-line ask?

From:
Steve Klabnik
Date:
2012-03-05 @ 18:50
Hey everyone:

Someone posted this to the hackety site:
http://hackety.com/questions/4f54643449714c0001006460

I'm actually kind of stumped. Can you do this?

Re: [shoes] Multi-line ask?

From:
Tobias Pfeiffer
Date:
2012-03-05 @ 19:02
On 03/05/2012 07:50 PM, Steve Klabnik wrote:
> Hey everyone:
>
> Someone posted this to the hackety site:
> http://hackety.com/questions/4f54643449714c0001006460
>
> I'm actually kind of stumped. Can you do this?
Yes you can! He is using the weird behaviour that 2 strings are 
concatenated like this: "a""b" => "ab" if you remove this, it works 
around here:

question = "Please read the lines below and answer the question: \n \n " +
   "Line 1 "\n"" +
   "Line 2 "\n"" +
   "Line 3 "\n"" +
   "Line 4 "\n"" +
   "Line 5 "\n"" +
   "Line 6 "\n" "\n""
ask question

I'll answer on the question as soon as I remember my login ^^

Tobi

Re: [shoes] Multi-line ask?

From:
Tobias Pfeiffer
Date:
2012-03-05 @ 19:11
On 03/05/2012 08:02 PM, Pfeiffer, Tobias wrote:
> On 03/05/2012 07:50 PM, Steve Klabnik wrote:
>> Hey everyone:
>>
>> Someone posted this to the hackety site:
>> http://hackety.com/questions/4f54643449714c0001006460
>>
>> I'm actually kind of stumped. Can you do this?
> Yes you can! He is using the weird behaviour that 2 strings are
> concatenated like this: "a""b" =>  "ab" if you remove this, it works
> around here:
>
> question = "Please read the lines below and answer the question: \n \n " +
>     "Line 1 "\n"" +
>     "Line 2 "\n"" +
>     "Line 3 "\n"" +
>     "Line 4 "\n"" +
>     "Line 5 "\n"" +
>     "Line 6 "\n" "\n""
> ask question
>
> I'll answer on the question as soon as I remember my login ^^
>
> Tobi
>
herp derp, copy & paste from hacketyhack doesn't work, was the old 
snippet, here is the right one:

   question = "Please read the lines below and answer the question: \n\n" +
    "Line 1 \n" +
    "Line 2 \n" +
    "Line 3 \n" +
    "Line 4 \n" +
    "Line 5 \n" +
    "Line 6 \n\n"
   ask question

also removed some unnecessary white spaces.

Sorry for the message flood :-(