From 767416006b9ada6d125d8c702bc431470ad2ed1b Mon Sep 17 00:00:00 2001 From: juliousmulumba23 <91404716+juliousmulumba23@users.noreply.github.com> Date: Wed, 20 Jul 2022 22:43:23 -0400 Subject: [PATCH] Update 5-challenge-wax-poetic.py On some ocassions, adj3 turns out to start with a vowel so the article before it should be conditional. --- .../5-challenge-wax-poetic.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ch09-lists-tuples-and-dictionaries/5-challenge-wax-poetic.py b/ch09-lists-tuples-and-dictionaries/5-challenge-wax-poetic.py index 7b9ed8a..4eeee6c 100644 --- a/ch09-lists-tuples-and-dictionaries/5-challenge-wax-poetic.py +++ b/ch09-lists-tuples-and-dictionaries/5-challenge-wax-poetic.py @@ -97,13 +97,18 @@ def make_poem(): article = "An" else: article = "A" + + if "aeiou".find(adj3[0]) == 1: # First letter of adj3 is a vowel + article2 = "An" + else: + article2 = "A" # Create the poem poem = ( f"{article} {adj1} {n1}\n\n" f"{article} {adj1} {n1} {v1} {prep1} the {adj2} {n2}\n" f"{adv1}, the {n1} {v2}\n" - f"the {n2} {v3} {prep2} a {adj3} {n3}" + f"the {n2} {v3} {prep2} {article2.lower()} {adj3} {n3}" ) return poem