Skip to content

Commit

Permalink
an edited version of Greg's Question Bank
Browse files Browse the repository at this point in the history
  • Loading branch information
strasburgerad committed Sep 23, 2012
1 parent 446aa5c commit 183775f
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions questionBank.py
Expand Up @@ -18,19 +18,14 @@ def __init__(self, lesson):

#Select all the question Id's from the question bank
#given the appropriate lesson
cur.execute("SELECT questionIndx FROM QuizDatabase.db WHERE lesson={}".format(self.lesson))
cur.execute("SELECT questionIndx FROM QuizDatabase.db WHERE lesson= ? order by random", (self.lesson,) )
rows = cur.fetchall()

#Take all of the question Id's and put them in a list
self.questionsList = []
for row in rows:
self.questionsList.append(row[0])


#The list of questions needs to be randomized
#Can be done via sqlite but not sure how
random.shuffle(self.questionsList)

def getQuestion(self):
'''Grabs a random question from the database to be used next
pre: questionsList cannot be empty
Expand Down

0 comments on commit 183775f

Please sign in to comment.