Get the lowest possible pylint score within 128 bytes of python

13

2

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.

user82938

Posted 2018-09-19T13:25:12.703

Reputation: 131

2If 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. – Jonathan Frech – 2018-09-19T13:32:30.993

@JonathanFrech Good point. I've set to 128 bytes. Thanks for your help! – user82938 – 2018-09-19T13:33:19.437

2I suggest to change the title to Python 3.6 instead of python to improve challenge scope clarity. – Jonathan Frech – 2018-09-20T13:54:14.760

Answers

14

-5430

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

Try it online!

Bryan K

Posted 2018-09-19T13:25:12.703

Reputation: 241

4Welcome to PPCG; "hello world" != "Hello World" -- so you should probably fix your capitalization. – Jonathan Frech – 2018-09-19T22:39:05.640

4

-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!

Jonathan Frech

Posted 2018-09-19T13:25:12.703

Reputation: 6 681

-3330 is the score with a trailing newline, which puts the byte count at 129. The missing final newline decreases the score to -3340. – Dennis – 2018-09-19T15:21:25.257

-3540 – Dennis – 2018-09-19T15:52:32.207

@Dennis Did not know pylint penalizes you for the trailing new line; thanks for the improvement. – Jonathan Frech – 2018-09-19T15:58:00.837

1

-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.

Jo King

Posted 2018-09-19T13:25:12.703

Reputation: 38 234

0

-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  

user82938

Posted 2018-09-19T13:25:12.703

Reputation: 131

3Could you not squeeze another ,os in there? Or are the two trailing spaces necessary for your score? – Jonathan Frech – 2018-09-19T14:02:15.510