From b7a5a05422a698e1352d864c067b640668035930 Mon Sep 17 00:00:00 2001 From: Breanna Klopp Date: Wed, 30 Oct 2024 15:28:14 -0400 Subject: [PATCH] I added code for Caesar cipher program --- cipher.py | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/cipher.py b/cipher.py index 0e772db..f037242 100644 --- a/cipher.py +++ b/cipher.py @@ -1 +1,41 @@ -# add your code here +substitution = { + "a": "f", + "b": "g", + "c": "h", + "d": "i", + "e": "j", + "f": "k", + "g": "l", + "h": "m", + "i": "n", + "j": "o", + "k": "p", + "l": "q", + "m": "r", + "n": "s", + "o": "t", + "p": "u", + "q": "v", + "r": "w", + "s": "x", + "t": "y", + "u": "z", + "v": "a", + "w": "b", + "x": "c", + "y": "d", + "z": "e", +} + +plain_text = input("Please enter the message you'd like to encrypt: ") +plain_text = plain_text.lower() + +encrypted_text = "" +for character in plain_text: + if character in substitution: + character = substitution[character] + encrypted_text += character + +print(encrypted_text) + +