a='Happy Birtday'
b='to you'
print(a,b,',\n',a,b,',\n',a,'dear name!\n',a,b,'.')
81 char python[Exercise] Happy Birthday golf
6 days later
- Edited
a="happy birthday"
b=" to you,\n"
print a+b+a+b+a+" dear name!\n"+a+b[:7]+"."
- Edited
69 characters so far.
a='to you,';print"Happy Birthday %s\n"*4%(a,a,'dear name!','to you.')
Nice, I was thinking of similar stuff but i could not get the *4 to work...m0ei wrote69 characters so far.a='to you,';print"Happy Birthday %s\n"*4%(a,a,'dear name!','to you.')
- Edited
@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.
@m0ei: Your answer inserts an extra newline at the end.
- Edited
What if it does? The problem was to print those lines as seen and it was accomplished am I missing something?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.
It could look something like this
a='to you,\n';print"Happy Birthday %s"*4%(a,a,'dear name!\n','to you.')
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
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.NuclearVision wroteWhat if it does? The problem was to print those lines as seen and it was accomplished am I missing something?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.
It could look something like thisa='to you,\n';print"Happy Birthday %s"*4%(a,a,'dear name!\n','to you.')
- Edited
70 characters solution:
a='to you,';print"Happy Birthday %s\n"*4%(a,a,'dear name!','to you.'),