From a1be20faa13b7a803bd804a3b7abbbbbe7e50599 Mon Sep 17 00:00:00 2001 From: pythonboi Date: Sun, 12 Sep 2021 09:40:32 -0400 Subject: [PATCH] update the code with another method code solution --- Exercise.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Exercise.py b/Exercise.py index 8c6cffc..cce0fc9 100644 --- a/Exercise.py +++ b/Exercise.py @@ -66,12 +66,17 @@ def encrypt(text, shift): for count in text: en = alphabet.index(count) + shift if en >= len(alphabet): + fw = alphabet.index("a") + shift + fw -= 1 lw = alphabet.index(count) - shift - newEn += alphabet[lw] + newEn += alphabet[fw] + # newEn += alphabet[nw] else: newEn += alphabet[en] - #print(en) + # print(en) print(newEn) + print(alphabet.index("a")) + # TODO-2: Inside the 'encrypt' function, shift each letter of the 'text' forwards in the alphabet by the shift amount and print the encrypted text. # e.g.