Exercise 8: Manual Word Count Without .split() — Possible Solution ==================================================================== sentence = "The quick brown fox jumps over the lazy dog" word_count = 0 previous_was_space = True # treat the very start as "just after a space" for ch in sentence: if ch.isspace(): previous_was_space = True else: if previous_was_space: word_count += 1 previous_was_space = False print(f"Word count: {word_count}") Output: Word count: 9 WHY THIS WORKS AS AN ANSWER ------------------------------ Without .split(), the only way to know a new word has started is to notice the exact moment the loop crosses from "on a space" to "on a non-space character" — a boundary, not a character type on its own. previous_was_space is what remembers what kind of character came immediately before the current one, updated on every single pass regardless of which branch ran. word_count only increments inside the else branch, and only when previous_was_space was True going into that character — meaning this non-space character is the very first one of a new word, not the second, third, or later character of a word already being counted. Starting previous_was_space as True (rather than False) is what correctly counts the very first word in the sentence, which has no space before it to trigger the transition naturally.