Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Agile Web Development (CITS3403).
RSS cloud
Jump to:

Why does changing one input break this code segment?

1 of 419 articles shown, currently no other people reading this forum.
From: Takoyaki N.
Date: Fri 22nd May, 11:22am
Apparently if you don't specify .all() or .first() it defaults to .all() but I would still specify 
.all() to make your code explicit.

When you are getting the index out of bounds error what index is it throwing the error at?  Perhaps 
add a print(i) just inside the loop.  If you are passing X mycheckboxs, the query is returning Y 
results then you will get an index error if X > Y

Perhaps add this code to see if it makes things clear for you.




> I'm trying to use a link to the quiz page and automatically display the chosen quiz by 
> using types and then "int(request.args.get('type'))"  however when I then go to use this 
> type to filter the quizes by quizCode, this breaks my code and gives me an index out of 
> bounds error. I tried converting the type to an int but it seems to somehow turn itself 
> back into a NoneType every-time the code tries to run and I'm not sure why. The code works 
> fine if I manually type quizCode='1' for example but when using selectedQuiz it breaks.

Related articles

Why does changing one input break this code segment? (all 5) RSS
├─ original   Fri 22nd May, 3:34am, ANONYMOUS
├─ reply 1   Fri 22nd May, 10:06am, Haolin W.
├─ reply 2   Fri 22nd May, 10:15am, ANONYMOUS  O.P.
├─ reply 3   Fri 22nd May, 10:19am, Haolin W.
└─ THIS   Fri 22nd May, 11:22am, Takoyaki N.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020