Oct-11-2017, 10:30 PM
(Oct-09-2017, 05:52 AM)j.crater Wrote: for loop indexes start with 0, there is no way around that. But you can accomodate "str(i)" to show the value you want (incremented).
When "return" statement executes, function exits. So if you want several iterations of for loop, you will need to place return elsewhere, and also consider a meaningful information it will return after function is executed.
In "primary_school_quiz()" function you return q, which is user's input, and not (necessarily) correct answer, if that is what you intended. Also, if you want questions to be different algebra problem in each iteration, place random number generation inside for loop, so it is executed again each time. Otherwise you will get same question over and over.
Thank you for the reply.. what would I add to the code so that it returns the number of questions answered correctly?