Ok, I see what vigenere cipher is supposed to do now. It would be helpful to link the lesson or explain the task.
You should keep the words lengths, preserve the spaces and replace the words by the key word written right behind itself, right?
Then what is this supposed to achieve:
This gives you the length of the string minus the length of the key, but the output string is supposed to be of the same length as the input string, right? How about using the inbuilt replace() function?
Ok, I see. But this way it will be hard to omit the modulo counter for the spaces.
The easiest way would be to loop through the whole string, create a new list for the letters to be concatenated and have an if/else clause to distinct between letters and spaces.