Exercise 3: Vowel vs. Consonant Counter — Possible Solution ==================================================================== sentence = input("Enter a sentence: ") vowels = 0 consonants = 0 for ch in sentence: if ch.isalpha(): if ch.lower() in "aeiou": vowels += 1 else: consonants += 1 print(f"Vowels: {vowels}") print(f"Consonants: {consonants}") Example run: Enter a sentence: The Quick Brown Fox Vowels: 5 Consonants: 11 WHY THIS WORKS AS AN ANSWER ------------------------------ The outer if ch.isalpha() check does the same job it did in this lesson's own accumulator example — it silently skips spaces and any punctuation before either counter ever gets touched. Once a character has passed that filter, it's guaranteed to be a letter, so the only remaining question is which of the two buckets it belongs in. ch.lower() in "aeiou" handles both cases in one line: lowering the character first means "A" and "a" are both correctly recognised as vowels without needing to check for both cases separately in the "aeiou" string itself.