Please help as I am getting this unexpected error and I cant understand it.

enter image description here

  • @DinoCoderSaurus I saw the answer that you suggested but I am not able to understand what exactly is the error about. Can you please elaborate on it? Jan 18 '17 at 16:47
  • Don't increment the key index if you don't cipher the message character. (ie the message character is not alphabetic). The expected output ciphers the s in say with z (to get r). Your output ciphers the s in say with a (to get s) Jan 18 '17 at 18:55

According to the spec, the key should only be advanced when it is used. Considering that, when you print a special character (non-alphabetical), as well as making sure that it is printed unchanged, the key should not be advanced.

This is how it should be:

INPUT:  world, say hello!
KEY:    bazba  zba zbazb
OUTPUT: xoqmd, rby gflkp!

And this is what your code is doing:

INPUT:  world, say hello!
KEY:    bazbazbazbazbazba
OUTPUT: xoqmd, szz gflkp!

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