From 9ffc4ef921cb5370cfb15fdf363a20231f48becf Mon Sep 17 00:00:00 2001 From: pythonboi Date: Tue, 7 Sep 2021 01:36:41 -0400 Subject: [PATCH] add a new code --- Caesar_Cipher.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Caesar_Cipher.py b/Caesar_Cipher.py index e69de29..1f87d0e 100644 --- a/Caesar_Cipher.py +++ b/Caesar_Cipher.py @@ -0,0 +1,20 @@ +alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z'] + +direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n") +text = input("Type your message:\n").lower() +shift = int(input("Type the shift number:\n")) + + +def encrypt(text, shift): + count_text = len(text) + move = [] + for run in range(0, count_text): + move += alphabet[shift] + if run in move: + move += alphabet[shift] + 1 + + print(move) + + +encrypt(text=text, shift=shift)