Python (Fall 2026) Module 9-7: S9 Explanation
Watch on YouTube →
Overview
Bill Moseley explains the S9 Python sandbox assignment: build an algorithm that ranks three passages about the phases of the Moon, written at fourth-grade, 10th-grade, and PhD levels. He suggests measurable features—including average word length, unique-word count, sentence length, and punctuation—and frames the task as practice turning a problem into a coded solution.
Key takeaways
- A text-sophistication algorithm can rank the three Moon-phase passages without identifying exact grade levels; an ordered numeric score is sufficient.
- Average word length and sentence length offer measurable clues for distinguishing simpler fourth-grade writing from more advanced prose.
- Vocabulary variety can be estimated by splitting text into words, converting the list to a set, and counting the unique entries.
- Punctuation frequency, including commas and semicolons, can serve as another feature in comparing the fourth-grade, 10th-grade, and PhD-level passages.
- The S9 assignment practices the core programming workflow: identify measurable properties of a problem, design an algorithm, and implement a solution in code.
Chapters
0:00
S9 Assignment: Rank Three Moon-Phase Passages
- The S9 sandbox task compares three passages about the phases of the Moon, written at fourth-grade, 10th-grade, and PhD levels.
- The algorithm should order the passages by sophistication; it can return scores such as 100, 150, and 250 instead of grade labels.
1:10
Measure Word Choice, Sentence Length, and Punctuation
- Possible indicators include average word length, sentence length, and vocabulary variety; more advanced writing may use longer words and more varied vocabulary.
- Moseley also suggests comparing punctuation, noting that commas and semicolons may occur more often in the PhD-level passage.
- To count distinct words, split a passage into individual words, convert the words to a set to remove duplicates, and count the set's elements.
2:16
Use the Text Analysis Task to Practice Algorithmic Thinking
- The measured features can contribute to a text-sophistication score that indicates which of the three sample passages is more advanced.
- Moseley presents the assignment as practice decomposing a problem and designing a coded solution, a recurring task in programming.
- As the class approaches the midterm, he describes the exercise as a way to assess students' comfort with programming and prepare for continued algorithmic thinking.
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Bill Moseley, Ph.D. - Computer Science Educator.