Count above a line
Inputs
values is a list of 0 to 14 whole numbers, each from 0 to 100. limit is a whole number from 0 to 100.
Your tasks
- Create a number
countthat starts at 0. - Use a loop over
values. Add 1 tocountfor each number strictly greater thanlimit. - Complete
countAboveso it returnscount. Return it, do not print it.
Example
With values = [60, 75, 75, 40, 90] and limit = 75, countAbove returns 1.
Rules
- A number equal to
limitdoes not count.
Test data
TEST DATA 1: values is [60, 75, 75, 40, 90], limit is 75
TEST DATA 2: values is [], limit is 10
Practice focus
One pass over a list to add, count, find the biggest and the smallest. Scanning an array once and keeping a running answer is the backbone of linear-time solutions.