Beginner
Verify citations against the retrieved sources
Write check_citations(answer, n_sources) that returns three sorted lists of ints: (cited, invalid, unused).
cited is every distinct number inside square brackets like [2]. invalid are cited numbers below 1 or above n_sources. unused are source numbers from 1 to n_sources that were never cited. Brackets with text, such as [sic], are ignored.
What Check tests
- Cited numbers are found and sorted
- Unused sources are reported
- A repeated marker counts once
- A number outside 1..N is invalid
- No citations at all
- Brackets with text are ignored
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.