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:
Input: Get data from the keyboard, a file, or some other device.
Output: Display data on the screen, or send data to a file or other device.
Math: Perform basic calculations like addition and multiplication.
Logic and decision making: Check for certain conditions and run the correct code statements based on those conditions.
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¶
Question
A program is:
- a set of instructions for performing a task
- something you read at a play or concert.
- a calculation.
- the same thing as an algorithm.