The encryption program is one of Practity’s fun Python challenges. You will have to create a keyword cipher, a program to encrypt or decrypt a message taking a keyphrase as input. You will have to combine a keyword cipher and shift cipher to encrypt and decrypt strings.
A cipher is a method to encrypt a string of text. One of the simplest ciphers is a shift cipher. It replaces each letter in a string with the following letter in the alphabet according to the number defined.
For example, using the number 3, the string ‘CAB’ would become ‘FDE’.
A keyword cipher is a little bit more complex and therefore more difficult to crack.
Your task is to write a program with a simple command line interface so that users can provide the inputs required. You will have to create functions to build encoder/decoder dictionaries, and to encode/decode the message. The whole program is written with dictionaries, “for” loops, if/else statements, functions and lists, so it is a great Python exercise to practice these concepts.
Emma Bateman is a software engineer based in the US. She holds a Bachelor of Science (B.S.), Computer science and a Master of Computational Linguistics.
DOWNLOAD / CONTENT
You will receive an email with a ZIP file. The download is also available on your Practity account.
The ZIP file includes:
- INSTRUCTIONS: A PDF with the project description. It includes an introduction section explaining briefly what a cipher is and how it works. There is also a guidelines section that breaks down the challenge into several exercises so you can complete the Python assignment step by step.
- SOLUTIONS: A Jupyter Notebook with detailed explanations and comments about how the code works. The code provided in the solutions (90 lines) has been written by a senior developer, so it is clean and easy to understand.
IMPORTANT: To see the solutions (Notebook) you need to have Jupyter or the ANACONDA package installed on your machine. If you do not have it, you may download it here. It is free.
WHAT YOU WILL PRACTICE
– Lists comprehension.
– Conditional statements.
– Loops (for).
– Function creation.
This type of Python challenges is highly recommended for intermediate Python students feeling comfortable with core Python concepts like loops and data structures.
If you need additional information, do not hesitate to contact us.