On 12/04/22 2:28 am, Peter Pearson wrote:
By looping over elements in "books" and incrementing counter i, which is used as an index both for "books" and for "students", you will produce an error whenever the number of books exceeds the number of students.
More fundamentally, it assumes there is a one-to-one correspondence between the list of books and the list of students. It doesn't look like that is true here -- one is a list if students with a given student ID (which doesn't make sense -- surely there should only be one?) and the other is a list of books with a given isbn (presumably all copies of the same book). It would make more sense for there only to be a list of books, and just one reference to the student, at that point in the code. Generally this whole piece of code seems hopelessly confused and needs to be re-thought. -- Greg -- https://mail.python.org/mailman/listinfo/python-list