0

My vigenere code, though anything but elegant, does encrypt per the specs. However, it still fails check50 on a number of points.

The go-to suggestion seems to be to include printf("\n") after the encryption. I've done that, but check50 still flags some things that seem to be working.

I've attached an image of the check50 results as they displayed in my terminal. Below that, in the same image, I ran ./vigenere to confirm the veracity of check50's output. While some of my output does fail, some of it seems to pass and yet still incurs red frowns. For example, when I use BAZ to encrypt BARFOO, I get CAQGON, yet check50 says that I don't.

BaRFoo encrypted with BaZ also seems to produce the intended results yet still gets flagged by check50.

Please advise if possible. Thank you for your help.

enter image description here

1 Answer 1

0

This is a case of not following the exact specification of the problem. One of the hidden lessons in the early problem sets is to learn to follow program specifications precisely.

check50 expects very exact output from the programs being tested. Any missing or extra spaces, carriage returns, prompts or anything else will cause check50 to show the test as failed.

In this case, the fails have nothing to do with the encoding of the text. Every run is failing because you are outputting a prompt where the pset did not specify that there should be a prompt. Also, although not checked, your prompt indicates that the string to be encoded must be at least two chars long, something that was not in the spec. Had there been a test for a string of 1 char length, it would also have failed.

This lesson is particularly important in team programming environments. Different people may be given different parts of a program to write. While they are generally free to do as they wish within their part of the project, they will absolutely have to meet certain requirements such as taking specific inputs and producing specific outputs or return values. This is necessary so that when everything is written, all the parts fit and work together.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

4
  • To answer your question, check50 is reporting, and your output shows the prompt that your program is printing out - "Please enter some text containing more than one character." Also, I should have looked closer. There actually is a test for a string of one character. Your code is failing that test and prompting the user to "Please enter a keyword of two or more..." That fails for two reasons. 1) The program should accept a string of one character. 2) it should also accept a key of one character.
    – Cliff B
    Commented Dec 22, 2015 at 3:35
  • But the specs say the program "must accept a single command-line argument: a keyword, k, composed entirely of alphabetical characters." A "keyword ... composed entirely of alphabetical characters" cannot be a single character. The specs themselves are misleading in this case--much like my inelegant code! ;-) At any rate, I don't mean to argue or seem ungracious. I'm very grateful for the help I receive here. But the specs and check50 do at times seem needlessly confusing to this admittedly novice, struggling student. Thank you again for your help.
    – MEK
    Commented Dec 22, 2015 at 3:50
  • It could be a reasonable argument. Perhaps they should have been more specific and said "...of one or more alphabetical characters." Most people interpret it as intended, that all characters in the string must be alphabetical, not a specification of length. If you feel strongly about it, perhaps you should share that message with staff.
    – Cliff B
    Commented Dec 22, 2015 at 4:01
  • And thank you for clarifying the meaning of the term prompt. Regardless of my nitpicking about the plural form of the word "characters" in the specs, I do need to spend more time combing over those specs and, if need be, seeking clarification before starting to code. It would probably save me time and effort in the end. A lesson worth learning to be sure.
    – MEK
    Commented Dec 22, 2015 at 4:05

You must log in to answer this question.

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