5
5
6
6
root .geometry ("800x800" )
7
7
8
- root .title ("Hacktoberfest Quiz" )
8
+ root .title ("Quiz Game App " )
9
9
10
10
scrollbar = Scrollbar (root )
11
- scrollbar .pack ( side = RIGHT , fill = Y )
11
+ scrollbar .pack (side = RIGHT , fill = Y )
12
12
13
- label = Label (root ,text = "Hacktoberfest Quiz " ,width = 20 ,height = 4 ,font = ("algerian" ,15 ))
13
+ label = Label (root , text = "Software Engineering Quiz " ,
14
+ width = 28 , height = 4 , font = ("algerian" , 15 ))
14
15
label .pack ()
15
16
17
+
16
18
class Quiz :
17
- print ('Welcome to the Hacktoberfest 2022 Quiz' )
18
- score = 0
19
- total_questions = 4
19
+ print ('Welcome to the Software Engineering Quiz' )
20
+ score = 0
21
+ total_questions = 4
20
22
21
23
def __init__ (self ):
22
24
# self.ask_question()
23
25
pass
24
26
25
27
def ask_question (self ):
26
- answer = input ('Are you ready to play the Quiz ? (yes/no) :' )
28
+ answer = input ('Are you ready to play the Quiz ? (yes/no) :' )
27
29
28
- if answer .lower ()== 'yes' :
29
- answer = input ('Question 1: What programming language was this quiz created in?' )
30
- if answer .lower ()== 'python' :
30
+ if answer .lower () == 'yes' :
31
+ answer = input (
32
+ 'Question 1: What programming language was this quiz created in?' )
33
+ if answer .lower () == 'python' :
31
34
self .score += 1
32
35
print ('correct' )
33
36
else :
34
37
print ('Wrong Answer :(' )
35
-
36
-
37
- answer = input ('Question 2: What is software Engineering?' )
38
- if answer .lower ()== 'application of engineering principle to the design a software' :
38
+
39
+ answer = input ('Question 2: What is software Engineering?' )
40
+ if answer .lower () == 'application of engineering principle to the design a software' :
39
41
self .score += 1
40
42
print ('correct' )
41
43
else :
42
44
print ('Wrong Answer :(' )
43
-
44
- answer = input ('Question 3: what does SDLC stand for?' )
45
- if answer .lower ()== 'software Development Life Cycle' :
45
+
46
+ answer = input ('Question 3: what does SDLC stand for?' )
47
+ if answer .lower () == 'software Development Life Cycle' :
46
48
self .score += 1
47
49
print ('correct' )
48
50
else :
49
51
print ('Wrong Answer :(' )
50
-
51
- answer = input ('Question 4: First phase of software development is:' )
52
- if answer .lower ()== 'requirement ananlysi' :
52
+
53
+ answer = input (
54
+ 'Question 4: First phase of software development is:' )
55
+ if answer .lower () == 'requirement ananlysi' :
53
56
self .score += 1
54
57
print ('correct' )
55
58
else :
56
59
print ('Wrong Answer :(' )
57
-
58
- print ('Thankyou for Playing the Hacktoberfest quiz game, you attempted' ,self .score ,"questions correctly!" )
59
- mark = (self .score / self .total_questions )* 100
60
- print ('Marks obtained:' ,mark )
60
+
61
+ print ('Thankyou for Playing the Hacktoberfest quiz game, you attempted' ,
62
+ self .score , "questions correctly!" )
63
+ mark = (self .score / self .total_questions )* 100
64
+ print ('Marks obtained:' , mark )
61
65
print ('BYE!' )
62
66
63
67
def get_score (self ):
64
68
return self .score
65
69
66
- def validate_question_one (self , question_one_value = '' ):
67
- if question_one_value .lower ()== 'python' :
70
+ def validate_question_one (self , question_one_value = '' ):
71
+ if question_one_value .lower () == 'python' :
68
72
self .score += 1
69
73
print ('correct' )
70
74
else :
71
75
print ('Wrong Answer1' )
72
76
print ('correct answer is python. ' )
73
- return True if question_one_value .lower ()== 'python' else False
74
-
77
+ return True if question_one_value .lower () == 'python' else False
78
+
75
79
def validate_question_two (self , question_two_value ):
76
- if question_two_value .lower ()== 'application of engineering principle to the design a software' :
80
+ if question_two_value .lower () == 'application of engineering principle to the design a software' :
77
81
self .score += 1
78
82
print ('correct' )
79
83
else :
80
84
print ('Wrong Answer2' )
81
85
print ('correct answer is application of engineering principle to the design a software. It is the Application of engineering principles to the design,development, and support of software and it helps to solve the challenges of low- quality software project. ' )
82
- return True if question_two_value .lower ()== 'application of engineering principle to the design a software' else False
86
+ return True if question_two_value .lower () == 'application of engineering principle to the design a software' else False
83
87
84
88
def validate_question_three (self , question_three_value ):
85
- if question_three_value .lower ()== 'software development life cycle' :
89
+ if question_three_value .lower () == 'software development life cycle' :
86
90
self .score += 1
87
91
print ('correct' )
88
92
else :
89
93
print ('Wrong Answer2' )
90
94
print ('correct answer is software development life cycle. it is a method for designing, developing, and testing high-quality softwarte.' )
91
- return True if question_three_value .lower ()== 'software development life cycle' else False
95
+ return True if question_three_value .lower () == 'software development life cycle' else False
92
96
93
97
def validate_question_four (self , question_four_value ):
94
- if question_four_value .lower ()== 'requirement ananlysis' :
98
+ if question_four_value .lower () == 'requirement ananlysis' :
95
99
self .score += 1
96
100
print ('correct' )
97
101
else :
98
102
print ('Wrong Answer2' )
99
103
print ('correct answer is requirement ananlysis, as based on it developer design and developed the software.' )
100
- return True if question_four_value .lower ()== 'requirement ananlysis' else False
104
+ return True if question_four_value .lower () == 'requirement ananlysis' else False
101
105
102
106
def evaluate (self ):
103
107
self .score = 0
@@ -110,67 +114,74 @@ def evaluate(self):
110
114
111
115
question_three_value = question_three .get ()
112
116
self .validate_question_three (question_three_value = question_three_value )
113
-
117
+
114
118
question_four_value = question_four .get ()
115
119
self .validate_question_four (question_four_value = question_four_value )
116
120
121
+ print ('Thankyou for Playing the Hacktoberfest quiz game, you attempted' ,
122
+ self .score , "questions correctly!" )
123
+ mark = (self .score / self .total_questions )* 100
124
+ my_label .config (text = "Your score is " + str (mark ) + "%" )
125
+ print ('Marks obtained:' , mark )
117
126
118
- print ('Thankyou for Playing the Hacktoberfest quiz game, you attempted' ,self .score ,"questions correctly!" )
119
- mark = (self .score / self .total_questions )* 100
120
- my_label .config (text = "Your score is " + str (mark ) + "%" )
121
- print ('Marks obtained:' ,mark )
122
-
123
-
124
-
125
127
126
128
quiz = Quiz ()
127
129
128
- w1_label = Label (root ,text = "Question 1: What programming language was this quiz created in?" ,font = ("arial" ,10 ),width = 100 ,height = 4 )
130
+ w1_label = Label (root , text = "Question 1: What programming language was this quiz created in?" , font = (
131
+ "arial" , 10 ), width = 100 , height = 4 )
129
132
w1_label .pack ()
130
- question_one = ttk .Combobox (root ,value = ["Python" ,"Java" ,"C++" ],width = 50 ,height = 4 )
133
+ question_one = ttk .Combobox (
134
+ root , value = ["Python" , "Java" , "C++" ], width = 50 , height = 4 )
131
135
w1_label .pack ()
132
136
question_one .current (0 )
133
137
question_one .pack ()
134
138
135
- w1_label = Label (root ,text = "" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
139
+ w1_label = Label (root , text = "" , font = ("arial" , 10 ), width = 200 , height = 4 )
136
140
w1_label .pack ()
137
141
138
- w2_label = Label (root ,text = "Question 2:What is software Engineering?" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
142
+ w2_label = Label (root , text = "Question 2:What is software Engineering?" , font = (
143
+ "arial" , 10 ), width = 200 , height = 4 )
139
144
w2_label .pack ()
140
- question_two = ttk .Combobox (root ,width = 50 ,height = 4 ,value = ["Designing a software" ,"Testing a software" ,"Application of engineering principle to the design a software" ,"None of the above" ])
145
+ question_two = ttk .Combobox (root , width = 50 , height = 4 , value = [
146
+ "Designing a software" , "Testing a software" , "Application of engineering principle to the design a software" , "None of the above" ])
141
147
question_two .current (0 )
142
148
question_two .pack ()
143
149
144
- w2_label = Label (root ,text = "" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
150
+ w2_label = Label (root , text = "" , font = ("arial" , 10 ), width = 200 , height = 4 )
145
151
w2_label .pack ()
146
152
147
153
148
- w3_label = Label (root ,text = "Question 3:what does SDLC stand for?" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
154
+ w3_label = Label (root , text = "Question 3:what does SDLC stand for?" ,
155
+ font = ("arial" , 10 ), width = 200 , height = 4 )
149
156
w3_label .pack ()
150
- question_three = ttk .Combobox (root ,width = 50 ,height = 4 ,value = ["System Design Life Cycle" ,"Software Design Life Cycle" ,"System Development Life Cycle" ,"Software Development Life Cycle" ])
157
+ question_three = ttk .Combobox (root , width = 50 , height = 4 , value = [
158
+ "System Design Life Cycle" , "Software Design Life Cycle" , "System Development Life Cycle" , "Software Development Life Cycle" ])
151
159
question_three .current (0 )
152
160
question_three .pack ()
153
161
154
- w3_label = Label (root ,text = "" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
162
+ w3_label = Label (root , text = "" , font = ("arial" , 10 ), width = 200 , height = 4 )
155
163
w3_label .pack ()
156
164
157
- w4_label = Label (root ,text = "Question 4: First phase of software development is:" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
165
+ w4_label = Label (root , text = "Question 4: First phase of software development is:" , font = (
166
+ "arial" , 10 ), width = 200 , height = 4 )
158
167
w4_label .pack ()
159
- question_four = ttk .Combobox (root ,width = 50 ,height = 4 ,value = ["Coding" ,"Testing" ,"Design" ,"Requirement ananlysis" ])
168
+ question_four = ttk .Combobox (root , width = 50 , height = 4 , value = [
169
+ "Coding" , "Testing" , "Design" , "Requirement ananlysis" ])
160
170
question_four .current (0 )
161
171
question_four .pack ()
162
172
163
- w4_label = Label (root ,text = "" ,font = ("arial" ,10 ),width = 200 ,height = 4 )
173
+ w4_label = Label (root , text = "" , font = ("arial" , 10 ), width = 200 , height = 4 )
164
174
w4_label .pack ()
165
175
166
176
167
- button = Button (root ,text = "Submit" ,font = ("bell mt" ,10 ), command = quiz .evaluate )
177
+ button = Button (root , text = "Submit" , font = (
178
+ "bell mt" , 10 ), command = quiz .evaluate )
168
179
button .pack ()
169
180
170
181
171
182
# w6_label = Label(root,font=("arial",10),width=100,height=4, textvariable=quiz.get_score())
172
183
my_label = Label (root ,
173
- text = "Score:" )
184
+ text = "Score:" )
174
185
my_label .pack ()
175
186
176
187
0 commit comments