We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6f2ec36 commit e81e92eCopy full SHA for e81e92e
Files/Exercise Solutions/quiz.py
@@ -1,4 +1,4 @@
1
-import csv
+import csv, random
2
3
def get_questions():
4
questions = []
@@ -25,8 +25,16 @@ def ask_question(question,score):
25
def main():
26
questions = get_questions()
27
score = 0
28
- for question in questions:
+ print("Welcome to the farming quiz!")
29
+ print("============================")
30
+ print()
31
32
+ number = int(input("There are {0} questions - how many do you want in your quiz: ".format(len(questions))))
33
+ while number > 0:
34
+ question = random.choice(questions)
35
score = ask_question(question, score)
36
+ questions.remove(question)
37
+ number -= 1
38
print("Your final score was {0} out of {1}".format(score,len(questions)))
39
40
if __name__ == "__main__":
0 commit comments