I'm stuck with this problem, as the looping for the keyword isn't working and I don't find why. I've check already one answer about this topic but I don't see yet what the issue with my code is.

enter image description here


  • I'm actually using the modulo operator at the first loop, but the only character taken in the keyword to encrypt the message is always the first one
    – JLDG
    Commented Mar 17, 2016 at 13:05

1 Answer 1


You can't do this pset with nested loops. Simply put, your code will encode all of the chars in the plain text using the first character in the key string, then repeats with the second character in the key string and so on.

You need to loop through the plain text string once, and manually increment the index for the key string only when a character is encoded.

There are other issues in the code. Perhaps it would be good to go back and review all of the class material on this pset.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • Thanks Cliff B. I now understand how to increase the index manually, but I'll have a look again to the course materials as I'm having more issues.
    – JLDG
    Commented Mar 18, 2016 at 18:31

You must log in to answer this question.

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