Re: What to do to correct the error written below:

2022-04-12 Thread Peter Pearson
On Tue, 12 Apr 2022 04:56:22 -0700 (PDT), NArshad 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. Is there some

Re: What to do to correct the error written below:

2022-04-12 Thread Greg Ewing
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

Re: What to do to correct the error written below:

2022-04-11 Thread Dennis Lee Bieber
On Mon, 11 Apr 2022 00:14:49 -0700 (PDT), NArshad declaimed the following: >for i in issuedBooks: Loop control variable is "i"... >i=0 Control variable "i" has been overwritten so any use of "i" following this is suspicious >for l in books:

Re: What to do to correct the error written below:

2022-04-11 Thread Dennis Lee Bieber
On 11 Apr 2022 14:28:51 GMT, Peter Pearson declaimed the following: >Is this homework? In this newsgroup, by custom, homework problems >should be announced as such, since the best answer to a homework >question is different from the best answer to a real-life problem. > It's a return to

Re: What to do to correct the error written below:

2022-04-11 Thread Peter Pearson
On Mon, 11 Apr 2022 00:14:49 -0700 (PDT), NArshad wrote: [snip] > books = list(models.Book.objects.filter(isbn=i.isbn)) > students = list(models.Student.objects.filter(user=i.student_id)) > i=0 > for l in books: > >

Re: What to do to correct the error written below:

2022-04-10 Thread Peter Pearson
On Sat, 9 Apr 2022 04:59:05 -0700 (PDT), NArshad wrote: > I have accidentally deleted one account in a Django project because of > which one of the pages is no more accessible and is giving the error > written below: > > IndexError at /view_issued_book/ > list index out of range > > and the error