Summary - Algorithm concept
- Algorithms course
- Beginner
- Lesson 4/80
- 4 min
Tie definition, properties and pseudocode together with a mini task.
Summary - Algorithm concept
In this group you learned what an algorithm is, its five core properties and how to express it in pseudocode. An algorithm has finite, definite and effective steps.
Pseudocode is a human-friendly way to write algorithms using if, for, return.
Practice Subtract two numbers
Write subtract(a, b). Return a - b and print 7 with print(subtract(10, 3)).
Starter code
def subtract(a, b):
# Subtract two numbersSample solution
def subtract(a, b):
# Subtract two numbers
return a - b
print(subtract(10, 3))Expected output
7
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Summary - Algorithm concept: match the terms
| Term | Meaning |
|---|---|
Algorithm |
Step sequence |
Finiteness |
Ends |
Pseudocode |
Human reads |
Output |
Result |
2 Algorithm definition
An algorithm is a ____ sequence of steps.
An algorithm is a finite sequence of steps.
Explanation: finite is right.
3 Which is required for an algorithm?
- Infinite loop
- Randomness
- Ambiguity
- Finiteness Correct answer
Explanation: Finiteness is required.