Challenge
PastOne concept, three rungs. Reaching rung 1 is the goal, so climb as far as you can.
The Pass Mark
if/else + comparing numbers
Who passed
Write a function called count_passes
A mark of 40 or more is a pass. Return how many marks in the list are passes. An empty list has 0 passes.
Examples
| Input | Output |
|---|---|
| [40, 39, 100] | 2 |
| [] | 0 |
| [39] | 0 |
| [40] | 1 |
There are extra hidden tests, so make it work in general, not just for these.
Did everyone pass
Write a function called all_passed
Return True if every mark in the list is 40 or more, and False if even one mark is below 40. An empty list returns True, because nobody failed.
Examples
| Input | Output |
|---|---|
| [40, 50] | True |
| [39, 50] | False |
| [] | True |
| [40] | True |
There are extra hidden tests, so make it work in general, not just for these.
The lowest pass
Write a function called lowest_pass
Look only at the marks that passed, and return the smallest one of those. If nobody passed, return None.
Examples
| Input | Output |
|---|---|
| [40, 50, 90] | 40 |
| [10, 20] | None |
| [] | None |
| [45] | 45 |
There are extra hidden tests, so make it work in general, not just for these.
Finish Rung 1 and today counts. Rungs 2 and 3 are there if you want to push further.