(sequence, goal)
| 55 | |
| 56 | print("Example 2") |
| 57 | def find_closest(sequence, goal): |
| 58 | for index, value in enumerate(sequence): |
| 59 | if goal < value: |
| 60 | return index |
| 61 | raise ValueError(f"{goal} is out of bounds") |
| 62 | |
| 63 | index = find_closest(data, 91234.56) |
| 64 | assert index == 91235 |