Offset key WORD for cipher in Python -
So I'm halfway through computing GCSE controlled evaluation in school.
I have completed a task that was to create a Kaiser cipher of my controlled evaluation that encrypts the message by changing each letter from a significant number in the message that the user must enter.
The task is to do this, but a key word.
This means that the keyword string should be multiplied, unless the length of the message is the same, the user who enters (part one). For example:
Keywords = GCS
User Message = Hello, my name is Jake
The keyword should be multiplied so that it is so Let's see something.
gcsegcsegcsegcsegcsegc
Hello, my name is Jake
Now the message above and the key word The length (22 characters, though they do not see it)
Next, each esque value of each letter should be combined together, which means that the first letter of each string is added together , Then the second, then the third etc.
Until the program completes this process, each letter in the message has a new value, it will need to print the Encrypted message. Can the screen help the user to do with this? It is difficult to understand here but hopefully someone will know what I am about: The main issue is that I can not multiply the string with a number with a decimal number, there is some way around this? If no one can answer this question, please tell me how I can raise it, thanks.
Use multiplication here, use it with string over iteration:
< Pre> & gt; & Gt; & Gt; Iterplates from the import cycle & gt; & Gt; & Gt; Word = cycle ('gcse')> & gt; & Gt; & Gt; Message = 'hello, my name is jake' gt; & Gt; & Gt; '' .joy ([next (word) for c in the message 'gcsegcsegcsegcsegcsegc'
Comments
Post a Comment