16
\$\begingroup\$

pylint has no lower bound on the scores it will give your code. It uses the following metric to score code, with the maximum score being 10:

10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)

With python 3.6, try and write a program that:

  • Outputs "Hello World" when run from the command line (i.e. python script.py), and no other output.

  • Gets the lowest possible score from pylint, with default settings (i.e. pylint script.py)

  • Is strictly less than or equal to 128 bytes in size.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ I suggest to change the title to Python 3.6 instead of python to improve challenge scope clarity. \$\endgroup\$ Commented Sep 20, 2018 at 13:54

4 Answers 4

17
\$\begingroup\$

-5430

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++exit("Hello World")

Try it online!

\$\endgroup\$
0
5
\$\begingroup\$

-3330.00 -3540.00

  • Lost 210 points thanks to Dennis -- exiting with the required string instead of printing it.
exit("Hello World"
)>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_>_,_

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ -3330 is the score with a trailing newline, which puts the byte count at 129. The missing final newline decreases the score to -3340. \$\endgroup\$
    – Dennis
    Commented Sep 19, 2018 at 15:21
  • \$\begingroup\$ -3540 \$\endgroup\$
    – Dennis
    Commented Sep 19, 2018 at 15:52
  • \$\begingroup\$ @Dennis Did not know pylint penalizes you for the trailing new line; thanks for the improvement. \$\endgroup\$ Commented Sep 19, 2018 at 15:58
2
\$\begingroup\$

-840.0

print("Hello World"),0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0,0<0

Try it online!

0<0 seems to be pretty good, for a score of -30 points per each occurrence.

\$\endgroup\$
1
\$\begingroup\$

-335.0

126 bytes

print("Hello World");import os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os,os  
\$\endgroup\$
1
  • 3
    \$\begingroup\$ Could you not squeeze another ,os in there? Or are the two trailing spaces necessary for your score? \$\endgroup\$ Commented Sep 19, 2018 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.