[Solved] how to solve this problem:Multi Line Task: Hello World (Easy one) on codewars.com [closed]


Interesting puzzle. To get around the need to explicitly pass an argument to f, you can create a class with t (which is type), and use k to create a __new__ method that returns 'Hello, world!'. Since __new__ is a class method, _ would become the class object when an instance is instantiated:

f=t('',(),{'__new__':k('Hello, world!')})

so that f() returns: 'Hello, world!'

Break the above code into 2 characters per line, and you get:

f\
=\
t(
''
,(
),
{
'\
_\
_\
n\
e\
w\
_\
_\
':
k(
'\
H\
e\
l\
l\
o\
,\
 \
w\
o\
r\
l\
d\
!'
)}
)

which is exactly 33 lines.

1

solved how to solve this problem:Multi Line Task: Hello World (Easy one) on codewars.com [closed]