Returns all of 'elements' for which corresponding element in parallel list 'rank' is equal to the maximum value in 'rank'.
(elements, ranks)
| 31 | return max |
| 32 | |
| 33 | def select_highest_ranked (elements, ranks): |
| 34 | """ Returns all of 'elements' for which corresponding element in parallel |
| 35 | list 'rank' is equal to the maximum value in 'rank'. |
| 36 | """ |
| 37 | if not elements: |
| 38 | return [] |
| 39 | |
| 40 | max_rank = max_element (ranks) |
| 41 | |
| 42 | result = [] |
| 43 | while elements: |
| 44 | if ranks [0] == max_rank: |
| 45 | result.append (elements [0]) |
| 46 | |
| 47 | elements = elements [1:] |
| 48 | ranks = ranks [1:] |
| 49 | |
| 50 | return result |
nothing calls this directly
no test coverage detected