📖 Coding lessons · 1 of 4 · 4 min
What is an algorithm?
An algorithm is a list of clear steps to solve a problem. Computers follow steps exactly, so the steps must be in the right order and leave nothing out.
Algorithm to make lemonade:
- Take a glass of water.
- Squeeze half a lemon into it.
- Add two spoons of sugar.
- Stir until the sugar dissolves.
- If it is too sour, add more sugar and stir again.
Notice step 5: a decision (if). Programs are built from three ideas: sequence (steps in order), selection (if) and repetition (loops).
💡 Try writing the algorithm for brushing your teeth. Did you forget to open the toothpaste? 😄
