-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeo.py
144 lines (138 loc) · 4.06 KB
/
geo.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
import random
import json
import csv
a=0
L1=[0]
L2=[0]
L3=[0]
def Fifthy(x,n):
L1[0]=1
global a
p=1
while p==1:
A=Answer[x]
m=random.randint(0,n)
o=random.randint(0,n)
M=Answer[m]
N=Answer[o]
if options.index(A)!=options.index(M):
if options.index(A)!=options.index(N):
if m!=o:
p=2
'''print(options.index(A))
print(options.index(M))
print(options.index(N))
print(m,n)'''
choices[x][options.index(M)]='DELETED'
choices[x][options.index(N)]='DELETED'
print('=========================================================================================================================================')
print('question-',questions[x])
print('your options-',
'A)',choices[x][0],
'B)',choices[x][1],
'C)',choices[x][2],
'D)',choices[x][3])
option2=input('enter Your choice')
if option2==A:
print('correct')
a=1
else:
print('You lost')
print('Correct Option was',Answer[x])
a=0
def double_chance(x):
L2[0]=1
global a
A=Answer[x]
print('You now have two times to answer this question')
option2=input('enter Your choice')
if option2==A:
print('correct')
a=1
else:
print('You get Another Try')
option2=input('enter Your choice')
if option2==A:
print('correct')
a=1
else:
print('you lost')
print('Correct Option was',Answer[x])
a=0
def skip(x):
L3[0]=1
global a
a=1
print('You have skipped this question')
print('Correct Option was',Answer[x])
l=[]
questions1=[]
Answers1=[]
choices1=[]
choices=[]
options=['a','b','c','d','e']
with open ('geo.csv','r') as f:
data=csv.reader(f)
for row in data:
#print(row)
l.append(row)
questions1.append(l[0])
Answers1.append(l[2])
choices1.append(l[1])
#print(questions1)
questions=questions1[0]
Answer=Answers1[0]
choicesA=choices1[0]
#print(questions)
#print(Answer)
#print(choices)
choices.append(choicesA[0:5])
choices.append(choicesA[5:10])
choices.append(choicesA[10:15])
choices.append(choicesA[15:20])
#print(Choices)
Answer = [x[1:-1] for x in Answer]
#print(Answer)
def q1():
global a
n=len(questions)-1
x=random.randint(0,n)
print('question-',questions[x])
print('your options-',
'A)',choices[x][0],
'B)',choices[x][1],
'C)',choices[x][2],
'D)',choices[x][3],
'E)',choices[x][4])
print('=========================================================================================================================================')
option=input('Enter Your choice: ')
A=Answer[x]
if option.lower()==A:
print('Your Entered option is correct')
a=1
questions.pop(x)
choices.pop(x)
Answer.pop(x)
elif option.lower()=='e':
Option_for_Lifeline=int(input('Enter The Option From the Lifelines: '))
if Option_for_Lifeline==1:
Fifthy(x,n)
questions.pop(x)
choices.pop(x)
Answer.pop(x)
elif Option_for_Lifeline==2:
double_chance(x)
questions.pop(x)
choices.pop(x)
Answer.pop(x)
elif Option_for_Lifeline==3:
skip(x)
questions.pop(x)
choices.pop(x)
Answer.pop(x)
elif option not in options:
print('Invalid Entry')
a=0
else:
print('Wrong Answer')
a=0