0

My caesar code works well for lower case but adds extra characters for upper case even though I used the same strategy in coding.

:( encrypts "BARFOO" as "EDUIRR" using 3 as a key \ expected output, but not "E_D^UUIIRRRR\n" :( encrypts "BaRFoo" as "FeVJss" using 4 as a key \ expected output, but not "F`eVVJJss\n"

Why would it work for lower case but not upper case?

Thanks!

0

I got it to work by changing my statements from IF...Else (on isupper and islower) to If...If. While I've googled the difference in if and else statements, I don't really have a good grasp of it.

1
  • Glad you figured it out! Now be sure to select an answer by clicking the green check mark, even if it is on your own answer, in order to prevent this from becoming a Zombie Question! – hotwebmatter Sep 5 '16 at 3:57
0

You can and should do that. In fact, have 3 ifs to handle uppercase, lowercase and non-alphabetical numbers/symbols. You can do this via: if { else if { else if { or you can drop the "else"s altogether (if you do, you don't need to indent the lines, not that it matters functionally, just for stylistic/readability considerations).

You must log in to answer this question.

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