liveBook · Manning

Vowel

As explained in Python Workout, Second Edition

A vowel sound is a speech sound articulated with an open vocal tract and functioning as the vocalic nucleus of a syllable.

A vowel is treated here as one of the letters a, e, i, o, or u. The programming exercises use this letter-based rule as an approximation of vowel sounds. section 3.10

Use vowels when implementing string transformations:

  • Test membership with `word[0] in 'aeiou'` instead of repeating comparisons or writing a manual search loop. section 3.3
  • Scan each character when every vowel must trigger an insertion, adding `ub` before vowels while leaving other letters unchanged. section 3.11
  • Treat adjacent vowels independently in the simplified exercise, even when they might represent one sound. section 3.10

Ubbi Dubbi

Applying `ub` before each vowel transforms `milk` into `mubilk`, `program` into `prubogrubam`, and `soap` into `suboubap`. section 3.10

if word[0] in 'aeiou':

The compact membership test demonstrates the idiomatic Python strategy for checking whether a character is a vowel. section 3.3

How Python Workout, Second Edition covers it

How deep it goes
Defines vowels through five letters and works through membership tests and repeated string transformations, stopping short of phonetics.
Examples
Demonstrates vowels with milk, program, octopus, elephant, soap, air, eat, python, and computer.
What it assumes
Assumes basic Python strings, indexing, iteration, lists, joining, and sequence membership.
What you can do after
Build it from scratch by testing vowel membership and writing string translators that branch or insert text around vowels.
How it connects
Connects vowels with strings, sequences, iteration, membership testing, Pig Latin, and Ubbi Dubbi.

Also explained in

Compare how 2 books explain vowel →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Python Workout, Second Edition. The section links point to the parts of the book it draws on.