From 6896d532d2566bd8b0810ac7f0fef423cf780a57 Mon Sep 17 00:00:00 2001 From: lolabird Date: Sun, 19 Nov 2023 19:36:11 -0700 Subject: [PATCH] Get plurals taken care of --- thinkcspy/Chapter-12-Exercises/Problem5.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thinkcspy/Chapter-12-Exercises/Problem5.py b/thinkcspy/Chapter-12-Exercises/Problem5.py index 45f7e05..3618531 100644 --- a/thinkcspy/Chapter-12-Exercises/Problem5.py +++ b/thinkcspy/Chapter-12-Exercises/Problem5.py @@ -25,10 +25,14 @@ def translator(english): word = englishList[i] word = word.lower() newWord = "" + lengthy = len(newWord) - 1 for char in word: if char.isalpha(): newWord += char + + if newWord[lengthy] == 's': + newWord = newWord[0:lengthy] if newWord in pirate: englishList[i] = pirate[newWord]