+ 1

I require some help and feedback on a project I made

A while ago I made a post on suggestions for a challenge and the most common one was a cipher. I had already been making some other projects and was giving some time to the cipher as well since I thought it would be fun. I made it a while ago with both a encrypter and a decrypter. Unfortunately the other projects I had made can't be posted on sololearn since they require modules that sololearn can't support It would be a great help if you would take your time to suggest on ways of improving it and making it shorter. Thanks in advance https://code.sololearn.com/czv946P74M6F/?ref=app

24th Aug 2019, 1:36 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar
3 Réponses
+ 4
I'm not a regular Python practitioner, but I feel that the code can be heavily simplified. When it comes to Ceaser Cipher, encryption and decryption can be done using the same function with minimal additional code, since the shifting operations are essential the same, just in the opposite direction. Is there any functional difference between "encode" and "encrypt" in your code? I just skimmed through and didn't really examine everything thoroughly. https://code.sololearn.com/cC8WW6dRT063/?ref=app
24th Aug 2019, 2:08 PM
Hatsy Rei
Hatsy Rei - avatar
+ 4
I agree with Hatsy Rei that a shift code should be a simple operation for letters and numbers. You can add a few lines to deal with the shift 'going round the corner', like z + 2 -> b. The encode and decode functions will be variations of the same concept. Here's a simple one for a single shift. https://code.sololearn.com/c56OF5R5p1th
24th Aug 2019, 6:10 PM
David Ashton
David Ashton - avatar
+ 1
The encode and encrypt do not have a functional difference I want a type of cipher that is user friendly and can be easily controlled (example if someone only wants to decrypt or encrypt something, or even wants to do both) I will try to reduce my lines of code
24th Aug 2019, 6:31 PM
Zamraz Arif Khan
Zamraz Arif Khan - avatar