Have you done the caesar's problem, that's should be you're base code as you will just need to modify it accepting instead of a key number, it would be a value from 0..26 where 0 is A
.
And as I've looked in to you're code you didn't wrap it in modulo 26. The modulo does wrap you're number in a specific limit or in other mathematical word it will return the remainder of the division of two points. For example 13 % 12
is equal to 1
, and 1 % 12
is equal to 1
, and so on etc. And also you didn't use the formula of caesar to easily manipulate the code base.
Where the formula for caesar and vigenere is:
c = (j + k) % 26
You should check the instruction video that is included in the problem set, the answer is all there where Zamyla explain. She also showed a small snippet of code there.