What to do to correct the error written below:
Greg Ewing
greg.ewing at canterbury.ac.nz
Mon Apr 11 18:28:41 EDT 2022
More information about the Python-list mailing list
Mon Apr 11 18:28:41 EDT 2022
- Previous message (by thread): What to do to correct the error written below:
- Next message (by thread): What to do to correct the error written below:
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): What to do to correct the error written below:
- Next message (by thread): What to do to correct the error written below:
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list