Some small algorithms turn up in almost every program.
3 lessons, about 1 h 15 min3 simulations10 problems3 practice questionsPython in every lesson
Some small algorithms appear in almost every program. You learn to total a set of values, count the ones that meet a condition, and find the maximum and minimum. Then you work out the average, in pseudocode and in Python, with the right starting values.
A linear search looks through a list item by item until it finds what it wants. A bubble sort puts a list in order by comparing neighbours and swapping them. You write both in pseudocode, dry-run them, and count their comparisons and passes.
A program must not trust the data a person types. Validation checks that data is sensible: range, length, type, presence and format checks, and the check digit. Verification checks that data was entered as intended: a visual check and a double entry check. You write the checks in pseudocode and Python.
Log in to join the discussion.
Loading…