LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#26 November 5 2013

NuclearVision
Member

Re: [Exercise] Happy Birthday golf

arithma wrote:

@raja: Your answer inserts an extra newline at the beginning. ---Edit My bad it doesn't.
@m0ei: Your answer inserts an extra newline at the end.

What if it does? The problem was to print those lines as seen and it was accomplished am I missing something?

It could look something like this

a='to you,\n';print"Happy Birthday %s"*4%(a,a,'dear name!\n','to you.')

Last edited by NuclearVision (November 5 2013)

Offline

#27 November 5 2013

xterm
Moderator

Re: [Exercise] Happy Birthday golf

NuclearVision wrote:

What if it does? The problem was to print those lines as seen and it was accomplished am I missing something?

>>> expected = 'something'
>>> got = 'something\n'
>>> assert expected == got
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError

Offline

#28 November 5 2013

arithma
Member

Re: [Exercise] Happy Birthday golf

NuclearVision wrote:
arithma wrote:

@raja: Your answer inserts an extra newline at the beginning. ---Edit My bad it doesn't.
@m0ei: Your answer inserts an extra newline at the end.

What if it does? The problem was to print those lines as seen and it was accomplished am I missing something?

It could look something like this

a='to you,\n';print"Happy Birthday %s"*4%(a,a,'dear name!\n','to you.')

Exactly. Now it's 72 characters. This game is about characters. Anyway, who cares, we're just making the game harder for each other for fun.

Offline

#29 November 5 2013

m0ei
Member

Re: [Exercise] Happy Birthday golf

70 characters solution:

a='to you,';print"Happy Birthday %s\n"*4%(a,a,'dear name!','to you.'),

Last edited by m0ei (November 5 2013)

Offline

Board footer