Question: PYTHON: Creating a Cypher Create a dictionary that will convert a code word to a cypher (use only lowercase letters). 1. Choose a cypher format
PYTHON: Creating a Cypher Create a dictionary that will convert a code word to a cypher (use only lowercase letters).
1. Choose a cypher format and enter you cypher dictionary ex. {a: p, b:h, c: q, }
Use this alphabet:
plain alphabet : abcdefghijklmnopqrstuvwxyz
cipher alphabet: phqgiumeaylnofdxjkrcvstzwb
2. Ask for a phrase using an input statement.
3. Loop through the phrase one letter at a time creating a cyber text.
4. Print the cypher text.
This is what I have so far and it's not working:
phrase = input('Please enter your phrase: ') cipher ={\"a\":\"p\",\"b\":\"h\",\"c\":\"q\",\"d\":\"g\",\"e\":\"i\",\"f\":\"u\",\"g\":\"m\",\"h\":\"e\",\"i\":\"a\",\"j\":\"y\",\"k\":\"l\",\"l\":\"n\",\"m\":\"o\",\"n\":\"f\",\"o\":\"d\",\"p\":\"x\",\"q\":\"j\",\"r\":\"k\",\"s\":\"r\",\"t\":\"c\",\"u\":\"v\",\"v\":\"s\",\"w\":\"t\",\"x\":\"z\",\"y\":\"w\",\"z\":\"b\"} def encrypt(phrase, cipher): result = ('') for letter in words: if letter in cipher: result = (result + cipher[letter]) else: result = (result + letter) return result print (cipher)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
