From 07a0539806bd9eaf048f8bf606cf473c8f9abe2d Mon Sep 17 00:00:00 2001 From: pythonboi Date: Thu, 16 Sep 2021 01:16:58 -0400 Subject: [PATCH] add else statementmodify the print statement --- Caesar_Cipher.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Caesar_Cipher.py b/Caesar_Cipher.py index 9e1bdc5..2e875d5 100644 --- a/Caesar_Cipher.py +++ b/Caesar_Cipher.py @@ -93,14 +93,16 @@ def caesar(text, shift, direction): alpLeft = ch - len(alphabet) # ch - len(alphabet) codeChar += alphabet[alpLeft] - print(f'The encode code is {codeChar}') + else: + codeChar += alphabet[ch] + print(f'The encoded text is {codeChar}') elif direction == 'decode': decChar = '' for new in text: deco = alphabet.index(new) - shift decChar += alphabet[deco] - print(f'The decode code is {decChar}') + print(f'The decoded text is {decChar}') caesar(text=text, shift=shift, direction=direction)