caesar-cipher

perofrming caesarcipher for a string using shift

perofrming caesarcipher for a string using shift Question: from string import ascii_lowercase as alphabet1 from string import ascii_uppercase as alphabet2 import letter as letter def cipher(user_input, shift): cipher1 = {char: alphabet1[(i + shift) % 26] for i, char in enumerate(alphabet1)} cipher2 = {char: alphabet2[(i + shift) % 26] for i, char in enumerate(alphabet2)} caesar_cipher = …

Total answers: 2

Both codes work(caesar cipher): but one code rearranges the output

Both codes work(caesar cipher): but one code rearranges the output Question: Beginner python programmer here. Before I knew about using .index(), i used a work around. Whilst it did work something peculiar happened. The output string was re-arranged and i don’t know why. Here is my code: alphabet = [‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, …

Total answers: 1

Validating file paths in Python

Validating file paths in Python Question: I have this code where the user has to input the name of a file which includes a message and the name of a file where the message must be written after its encrypted via Caesar-Cipher. I would like to validate the inputs, so that if there’s a wrong …

Total answers: 2

Encryption of an input with Caesar Cipher in Python

Encryption of an input with Caesar Cipher in Python Question: I have to write this code where The function must receive a path to a text file which must contain text composed of only English letters and punctuation symbols and a destination file for encrypted data. Punctuation symbols must be left as they are without …

Total answers: 2

Recursion in function causing return variable to equal 'None'

Recursion in function causing return variable to equal 'None' Question: I am making a Caesar cipher in Python. I had created a function to return the message the user would want to encrypt. I then wanted to do the same for cipher key. I wanted the function to only return the key if it was …

Total answers: 1