First, you should consider ciphering uppercase characters too!
Second, the formula assumes that each of your alphabetical characters has a value in [0, 25].
For example, when ciphering, the letter
A should be equivalent to
0, the letter
B should be equivalent to
Z should be equivalent to
a should be equivalent to
b should be equivalent to
z should be equivalent to
At the same time, after ciphering, each character should have its original ASCII value back.
For example, if the original
char was ciphered to
0), it should become
65. If, rather, it was ciphered to
1), it should become
66 and so on.
Same thing applies for lowercase
Third, the ciphering formula per the pset specification page is
c = (p + k) % 26
c is the ciphered
p is the current plain
char in [0, 25] and
k is the current key. And since
k must be an alphabetical
char, it has to be in [0, 25] either.
What you're doing wrong is
You're never getting the value of your plain
current) to be in [0, 25].
You're not considering uppercase
chars either in the plaintext or in the keyword.
97 to current at the end without subtracting
97 from it at the first place.