8
\$\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
    \$\begingroup\$ If you took the PEP standard of 80 characters per line over ten lines, your maximum byte count would be 800. I would suggest something around 64 or 128 bytes. \$\endgroup\$ – Jonathan Frech Sep 19 '18 at 13:32
  • \$\begingroup\$ @JonathanFrech Good point. I've set to 128 bytes. Thanks for your help! \$\endgroup\$ – user82938 Sep 19 '18 at 13:33
  • 1
    \$\begingroup\$ I suggest to change the title to Python 3.6 instead of python to improve challenge scope clarity. \$\endgroup\$ – Jonathan Frech Sep 20 '18 at 13:54
10
\$\begingroup\$

-5430

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

Try it online!

\$\endgroup\$
  • 2
    \$\begingroup\$ Welcome to PPCG; "hello world" != "Hello World" -- so you should probably fix your capitalization. \$\endgroup\$ – Jonathan Frech Sep 19 '18 at 22:39
4
\$\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\$
  • \$\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 Sep 19 '18 at 15:21
  • \$\begingroup\$ -3540 \$\endgroup\$ – Dennis Sep 19 '18 at 15:52
  • \$\begingroup\$ @Dennis Did not know pylint penalizes you for the trailing new line; thanks for the improvement. \$\endgroup\$ – Jonathan Frech Sep 19 '18 at 15:58
1
\$\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\$
0
\$\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\$
  • 2
    \$\begingroup\$ Could you not squeeze another ,os in there? Or are the two trailing spaces necessary for your score? \$\endgroup\$ – Jonathan Frech Sep 19 '18 at 14:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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