2.3. More About Programs

A program tells a computer how to complete a task, which might be something as simple as adding two numbers together or as complex as following voice commands.

Every program you’ve ever used is made up of instructions that do these same basic tasks:

  1. Input: Get data from the keyboard, a file, or some other device.
  2. Output: Display data on the screen, or send data to a file or other device.
  3. Math: Perform basic calculations like addition and multiplication.
  4. Logic and decision making: Check for certain conditions and run the correct code statements based on those conditions.
  5. Repetition: Quickly perform the same action over and over again.

We can describe programming as the process of breaking a large problem or task into smaller and smaller pieces. Once these pieces are small enough, we can solve each one with a few of the basic operations listed above. By combining the small solutions, our programs complete much bigger tasks.

The single most important skill for a programmer is problem solving. Problem solving means the ability to examine a problem, break it into smaller pieces, think creatively about how to solve those pieces, and clearly describe those solutions.

As you learn how to code, you will also develop your problem solving skills.

2.3.1. Check Your Understanding


A program is:

  1. a set of instructions for performing a task
  2. something you read at a play or concert.
  3. a calculation.
  4. the same thing as an algorithm.