Ask coding questions

← Back to all posts
Keyword Cipher decrypter
EmmaGao8 (33)

Hello! I am working on a Keyword Cipher decrypter, and I am having trouble making python do what I want.

BACKGROUND INFO:
Keyword cipher is a type of cipher. The first letter of the keyword is placed at the key-letter, the sencond letter of the keyword is placed at the letter after the key-letter, and so on. The rest of the letters just go from A-Z. However, you cannot repeat letters, aka, letters from the keyword cannot be written again later.

WHAT I WANT PYTHON TO DO & WHAT PYTHON IS DOING:
I want python to be able to decrypt a Keyword Cipher, but python keeps getting stuck at one of the steps. The only thing python is doing wrong is avoiding repeation.

SO FAR:
▪ Python doesn't accept repeated letters in the keyword.
▪ Python can do everything except avoiding repeation.
▪ I don't have any ideas for fixing this issue.

LINKS:
link to my code ⬇
https://replit.com/@EmmaGao8/Keyword-Cipher-decrypter#main.py
link to keyword cipher definition ⬇
https://www.geeksforgeeks.org/keyword-cipher/

Please put suggestions for fixing my code, and questions about my code in the comments below.

Thank you for your time and consideration.

Comments
hotnewtop
EmmaGao8 (33)

@CodeMaster007 i am a bit confused. does this program encrypt or decrypt?

CodeMaster007 (109)

I’m not sure what the difference is but basically it scrambles the letters and you have to solve it. It’s like a puzzle or what I think is a Key word cipher. @EmmaGao8

CodeMaster007 (109)

I’m not sure what the difference is but basically it scrambles the letters and you have to solve it. It’s like a puzzle or what I think is a Key word cipher. @EmmaGao8

CodeMaster007 (109)

Hi!
There’s actually a very similar program I found and can used as a guideline to compare Ciphers in python. It uses a similar formatting system and is really helpful. Btw, what is a “Key Letter?” Is is necessary for the program to function? In my program, I type in a command (/keyword) in advance and it scrambles the letters. The only issue I found is that the letters scrambled are in a fixed position. Meaning they are the same every time. If I figure that out, it should work better. Could you also explain what this program really does. I am pretty new to Ciphers and the whole idea is a bit confusing. Below is a screenshot of a example I did.
Best of luck,

CodeMaster007

Here is the program of the Keyword Cipher
https://replit.com/@CodeMaster007/Keyword-Cipher

EmmaGao8 (33)

@CodeMaster007 i tested this out on some other keyword ciphers and for some reason it doesn't work