hello-world: code fails the test locally but passes the uploader
See original GitHub issueI assume that Exercism should reject uploaded code if that code would fail the local test. But this hello-world.py
code passes if uploaded but fails the local test:
def hello():
print("Hello, World!")
hello()
As a newbie, it took me quite a while to figure out why it was failing the test locally—it fails because this function doesn’t actually “return a value” when run, it just prints a string and returns None
. So to pass the test locally, I had to write:
def hello():
return("Hello, World!")
print(hello())
I have two suggestions: (1) ensure that the uploader and the local test file are doing the same test so that a user either passes both or fails both; and (2) consider, in the instructions, making it clearer that the exercise’s goal (have the program return a value of “Hello, World!”) is not the same thing as having the program simply print or display the string “Hello, World!”.
I have not submitted this as a pull request because I don’t know how to get at the tests in the uploader and because changing the instructions for “Hello, World!” might have to be done across exercises (if you agree with me).
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Thanks @yawpitch . The explanation as to how different languages handle a similar situation is very helpful, as is the idea that creating some kind of a hurdle here is a feature, not a bug. Thanks for the explanation. It makes sense.
I’m afraid I’m not persuaded – and am not likely to be – but allow me to make unambiguous why.
Regarding this
return
line in particular there really is no contradiction in our rationales; the existing statement is used across all the tracks on exercism and is “perfectly clear” – meaning not “absolutely and rigorously unambiguous” but “immediately and readily cognizable” – to the site’s targeted audience; the learning challenges presented to that audience as they start to pick up a new (and, usually, second or third) language are:Because that audience, whom we expect to have at least some programming experience, already knows that programming languages must have an in-built capacity for working with textual data and some means of giving a meaningful result back to the caller for further processing. The specific answer to those challenges is very different from language to language:
return
keyword.return
function is for something quite different).In yet other languages you’ll “return” by writing to a specific CPU register or handing back a pointer to a memory address. In some very new orchestration languages you’d make a PUT call to a RPC / HTTP endpoint … given all of that the notion of “set a return value that is a string” isn’t necessarily sensible to all of those – or to people coming to Python from them – while the notion of a returning / giving back a specific string / piece of text, broadly, is.
So the intentional ambiguity, on our part, is indeed in prodding the user to recognize those challenges and to begin thinking about how to address them. That provocation is both warranted and clear, and no we don’t want to “give away the ghost” by providing an overly explicit, especially language-specific, answer. For our primary audience there’s no need for this particular phrase to be any more explicit than it already is.
Further, when it comes to those at the fringes or outside of that audience, we’ve got a bit of a filtering problem … the simple truth is that anyone who cannot make it past
hello-world
without us resolving the ambiguity in this phrase more clearly is, to be perfectly frank, not sufficiently prepared for the exercises that will follow, and will overwhelm us if we lower the bar much further. We’re very much not trying to teach Python to the completely new, utterly first-time programmer, so we require anyone who is coming at it from that fresh a perspective to demonstrate sufficient initiative that they can download the files, run the tests locally at the command line, update the file(s) as required until they can get the tests to pass, and then upload their solution without handholding … that’s the minimum effort and skillset threshold we need met before our mentors begin to spend their – entirely volunteered – time trying to help the prospective student.You’ve responded to our provocation and demonstrated that initiative by getting this far … that’s wonderful, because it means the site is working for you, even if it’s been frustrating. I very much appreciate the effort you’re attempting to put into helping the community, we need that sort of help. However I’m also aware of what’s going on “behind the scenes” as we move towards rolling out more changes that are meant to address the issues of complete newbies while also keeping maintainer / mentor workloads sustainable, and I hope that you can appreciate that @cmccandless and I know where the energy and time of maintainers needs to be focussed … which is, gently but firmly, NOT on working to make
hello-world
any more accessible than it already is.All that said please do ping this thread when you submit a PR on the “check” copy.