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?
#9
(Oct-12-2017, 09:06 AM)j.crater Wrote: At the line:
return q
instead of q, you would need to return a different variable, which holds number of questions answered correctly. But you first have to implement the logic that counts correct answers and stores them in that variable. Perhaps you have already done it, but the code you have originally posted doesn't have it.

How would you count correct answers when using random generator?
So far my code looks like this:
if flag == 0:
        for i in range (1,n+1):
            n1= random.randint(0,9)
            n2= random.randint(0,9)
            x= input('Question '+str(i)+':'+'\n'+'What is the result of '+str(n1)+'-'+str(n2)+'? ')
    elif flag == 1:
        for i in range (1,n+1):
            n1= random.randint(0,9)
            n2= random.randint(0,9)
            x= input('Question '+str(i)+':'+'\n'+'What is the result of '+str(n1)+'^'+str(n2)+'? ')
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 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 student8 - Oct-12-2017, 10:53 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