-
Notifications
You must be signed in to change notification settings - Fork 0
/
day17_oop.py
38 lines (32 loc) · 954 Bytes
/
day17_oop.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# class User:
# def __init__(self, user_id, username):
# self.id = user_id
# self.username = username
# self.followers = 0
# self.following = 0
#
# def follow(self, user):
# user.followers += 1
# self.following += 1
#
#
# user_1 = User("001", "brandi")
# user_2 = User("002", "kent")
#
# user_1.follow(user_2)
# print(user_1.followers)
# print(user_1.following)
# print(user_2.followers)
# print(user_2.following)
from day17_data import Question, question_data, QuizBrain
question_bank = []
for question in question_data:
question_text = question["text"]
question_answer = question["answer"]
new_question = Question(question_text, question_answer)
question_bank.append(new_question)
quiz = QuizBrain(question_bank)
while quiz.still_has_questions():
quiz.next_question()
print("You've completed the quiz")
print(f"Your final score was: {quiz.score}/{quiz.question_number}")