Skip to content

Commit a8beaa1

Browse files
authored
Merge pull request #34 from LibraryCarpentry/feat/inputs-outputs
Add section on Defining Inputs and Outputs
2 parents 8c0b533 + df72915 commit a8beaa1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

episodes/computation_programming.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,23 @@ exercises: 10
2424

2525
*Decomposition* is crucial in any kind of problem breakdown, but especially so in programming. The computer must be told **precisely** what to do, and in what order, so problems must be broken down into discrete parts and each section coded appropriately.
2626

27-
Suppose we want to find the ten words most commonly used in a text. How might we go about that?
27+
#### Defining Inputs and Outputs
28+
29+
Before we can tell the computer *what* to do (the algorithm), we must clarify *what data* we are working with. Every computational problem involves a transformation:
30+
31+
1. **Input:** What is the starting state? What data do we have? What format is it in?
32+
2. **Output:** What is the desired goal? What should the result look like?
33+
34+
If we don't define these clearly, we cannot design effective steps to bridge the gap.
35+
36+
Suppose we want to find the ten words most commonly used in a text.
37+
38+
**Input:** A digital text file (e.g., a book chapter).
39+
**Output:** A list of the top 10 most frequent words.
40+
41+
The *process* (or algorithm) is the series of steps that turns that specific Input into that specific Output.
42+
43+
How might we go about that?
2844

2945
#### Linear code
3046

0 commit comments

Comments
 (0)