From Project ROSALIND: Calculating Expected Offspring http://rosalind.info/problems/iev/ Version History 2020-04-14 — David M. Ng — Initial version.
This project was implemented using table-driven code. This technique can be used when there is a repetitive pattern in the problem which can be decomposed into a relatively short loop in code combined with the specifics of each case stored as data in a table. The table is implemented using two parallel lists, one for the prompt text, and the other for the corresponding probabilities. A loop repeats for each of the table entries; the code does not need to know the number of cases, it is the number of entries in the table.