Python Forum
How to create a question generator?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to create a question generator?
#2
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.
Reply


Messages In This Thread
How to create a question generator? - by student8 - Oct-07-2017, 07:22 PM
RE: How to create a question generator? - by j.crater - Oct-09-2017, 05:52 AM
RE: How to create a question generator? - by wavic - Oct-09-2017, 09:03 AM
RE: How to create a question generator? - by wavic - Oct-10-2017, 09:20 PM
RE: How to create a question generator? - by wavic - Oct-12-2017, 11:16 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020