0

So I made my Vigenere program and it passes all the tests except for the last one about not accepting keys with non-alphas. Now, I have a check in my program to stop this, and when it detects a non-alpha in the key, it returns 1, as the problem set specified. However, check50 doesn't accept this, and instead states:

  :( rejects "Hax0r2" as keyword
      \ expected output, not an exit code of 1

Why does it accept "return 1" for the other tests, but not for this one?

8

The pset says:

If your program is executed without any command-line arguments, with more than one command-line argument, or with one command-line argument that contains any non-alphabetical character, your program should complain and exit immediately, with main returning 1 (thereby signifying an error that our own tests can detect). [my emphasis]

It's the "should complain" that you are missing. check50 is expecting to get a printed message before you return 1.

7
  • Thanks. That worked out. I just thought that exiting out abruptly was enough of a complaint! I'll keep this in mind for future psets.
    – ajtalkar
    Jul 3 '14 at 23:53
  • @ajtalkar you may vote the answer up and accept it if it was helpful!
    – kzidane
    Jul 4 '14 at 0:07
  • perfect, I was having the same error, "should complain" means it has to print something
    – user1733
    Jul 8 '14 at 18:57
  • Really useful...I've just made the same mistake...thanks a lot. Sep 6 '14 at 18:14
  • I was having the exact same problem, and you saved my sanity. May 27 '15 at 4:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .