-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkbc.py
283 lines (267 loc) · 10.3 KB
/
kbc.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
def q1():
print("Q=1 Is Python case sensitive when dealing with identifiers?")
print("a) yes")
print("b) no")
print("c) machine dependent")
print("d) none of the mentioned")
def q2():
print("Q=2 What is the maximum possible length of an identifier?")
print("a) 31 characters")
print("b) 63 characters")
print("c) 79 characters")
print("d) none of the mentioned")
def q3():
print("Q=3 Which of the following is not a keyword?")
print("a) eval")
print("b)assert ")
print("c)nonlocal ")
print("d)pass ")
def q4():
print("Q=4 Which of these in not a core data type?")
print("a)Lists ")
print("b)Dictionary")
print("c)Tuples")
print("d)Class ")
def q5():
print("Q=5 Which of the following will run without errors?")
print("a)round(45.8) ")
print("b)round(6352.898,2,5) ")
print("c)round() ")
print("d)round(7463.123,2,1) ")
def q6():
print("Q=6 What is the return type of function id?")
print("a)INT ")
print("b)FLOAT ")
print("c)BOOL ")
print("d)DICT ")
def q7():
print("Q=7 What data type is the object below?")
print("L = [1, 23, 'hello', 1]")
print("a)list ")
print("b)dict ")
print("c)array ")
print("d)tuple ")
def q8():
print("Q=8 In order to store values in terms of key and value we use what core data type.")
print("a)dict ")
print("b)tuple ")
print("c)list ")
print("d)array ")
def q9():
print("Q=9 What arithmetic operators cannot be used with strings?")
print("a)+ ")
print("b)* ")
print("c)- ")
print("d)all of above mention ")
def q10():
print("Q=10 Which of the following commands will create a list?")
print("a) list1 = list() ")
print("b) list1 = []")
print("c) list1 = list([1, 2, 3])")
print("d) all of the mentioned")
def kbc():
global N
print("press 1 for play")
print("press 2 for quit")
choice=int(input("enter the choice:"))
if choice==1:
play()
# print("-------TOTAL POINT OF KBC ====:",total)
# if total1==500:
# print("--------WINNING AMOUNT IS 5 LACS")
elif choice==2:
return False
total=0
def play():
global total
print("-------------------- WELCOME TO KBC ----------------------------------")
q1()
a1=input("Enter the a,b,c,d:")
if a1=="a" or a1=="A":
total=total+50
RIGHT_Q.append("a1")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a1")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q2()
a2=input("Enter the a,b,c,d:")
if a2=="d" or a2=="D":
total=total+50
RIGHT_Q.append("a2")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a2")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q3()
a3=input("Enter the a,b,c,d:")
if a3=="a" or a3=="A":
total=total+50
RIGHT_Q.append("a3")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a3")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q4()
a4=input("Enter the a,b,c,d:")
if a4=="d" or a4=="D":
total=total+50
RIGHT_Q.append("a4")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a4")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q5()
a5=input("Enter the a,b,c,d:")
if a5=="a" or a5=="A":
total=total+50
RIGHT_Q.append("a5")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a5")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q6()
a6=input("Enter the a,b,c,d:")
if a6=="a" or a6=="A":
total=total+50
RIGHT_Q.append("a6")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a6")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q7()
a7=input("Enter the a,b,c,d:")
if a7=="a" or a7=="A":
total=total+50
RIGHT_Q.append("a7")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a7")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q8()
a8=input("Enter the a,b,c,d:")
if a8=="a" or a8=="A":
total=total+50
RIGHT_Q.append("a8")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a8")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q9()
a9=input("Enter the a,b,c,d:")
if a9=="b" or a9=="B":
total=total+50
RIGHT_Q.append("a9")
print("your score:",total)
else:
total=total-20
WRONG_Q.append("a9")
print("your score:",total)
print("--------------------------------------------------------------------------------------")
q10()
a10=input("Enter the a,b,c,d:")
if a10=="d" or a10=="D":
total=total+50
RIGHT_Q.append("a10")
else:
total=total-20
WRONG_Q.append("a10")
print("all question are over")
print("-----TOTAL SCORE IS:",total)
if total==500:
print("-------------------------THE WINNING AMOUNT IS 5 LACS")
elif 400<=total<500:
print("-------------------------THE WINNING AMOUNT IS 4 LACS")
elif 300<=total<400:
print("-------------------------THE WINNING AMOUNT IS 3 LACS")
elif 200<=total<300:
print("-------------------------THE WINNING AMOUNT IS 2 LACS")
elif total<200:
print("-------.......CLAP...CLAP....CLAP......----------")
print("----------------------------------------------------------------------------------------------------------------------")
print("----------------------------------------------------------------------------------------------------------------------")
print("THIS IS RIGHT QUESTIONS:")
for i in RIGHT_Q:
if i=="a1":
q1()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a2":
q2()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a3":
q3()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a4":
q4()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a5":
q5()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a6":
q6()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a7":
q7()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a8":
q8()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a9":
q9()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a10":
q10()
print("----------------------------------------------------------------------------------------------------------------------")
print("THIS IS WRONG QUETIONS:")
for i in WRONG_Q:
if i=="a1":
q1()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a2":
q2()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a3":
q3()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a4":
q4()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a5":
q5()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a6":
q6()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a7":
q7()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a8":
q8()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a9":
q9()
print("----------------------------------------------------------------------------------------------------------------------")
elif i=="a10":
q10()
print("----------------------------------------------------------------------------------------------------------------------")
RIGHT_Q=[]
WRONG_Q=[]
N=True
while N:
N=kbc()