-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudentResult.py
292 lines (291 loc) · 17.8 KB
/
StudentResult.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
284
285
286
287
288
289
290
291
292
import pandas as pd
import matplotlib.pyplot as plt
while True:
print('----------------------------------------------------------------------------')
print ('STUDENT RESULT MANAGEMENT SYSTEM - DEVELOPED BY: ALOK KUMAR VERMA')
print('----------------------------------------------------------------------------')
print('MENU:')
print('1. ADD NEW RECORD')
print('2. DISPLAY ALL RESULTS')
print('3. SEARCH A RESULT(s) ')
print('4. DELETE A RECORD(s)')
print('5. GRAPHICAL REPRESENTATION')
print('6. QUIT THE APPLICATION')
choice=int(input('Enter Your Choice as 1,2,3,4,5 or 6: '))
if choice==1:
while True:
id1=input('Enter Student ID: ')
name1=input('Enter Student Name: ')
phy1=int(input('Enter Physics Marks: '))
chem1=int(input('Enter Chemistry Marks: '))
maths1=int(input('Enter Mathematics Marks: '))
eng1=int(input('Enter English Marks: '))
ip1=int(input('Enter IP Marks: '))
per1=(phy1+chem1+maths1+eng1+ip1)/5
dic={ }
dic['ID']=id1
dic['NAME']=name1
dic['PHYSICS']=phy1
dic['CHEMISTRY']=chem1
dic['MATHS']=maths1
dic['ENGLISH']=eng1
dic['IP']=ip1
dic['PERCENTAGE']=per1
df=pd.DataFrame([dic])
df.to_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv",mode='a',na_rep=' ',header=False,index=False)
#df.to_csv('d:\person.csv',mode='a',na_rep=' ',header=True)
print('******************************************************************************')
print('Record Added Successfully')
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
break
elif choice==2:
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv",index_col='ID',usecols=[0,1,2,3,4,5,6,7])
print('\n',df)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==3:
while True:
print('----------------------------------------------------------------------------')
print('Select the criteria for searching! ! !')
print('1. Search Student Name-wise!')
print('2. Search Student ID-wise')
print('3. Search PHY MARKS-wise!')
print('4. Search CHEM MARKS-wise!')
print('5. Search MATHS MARKS-wise!')
print('6. Search ENGLISH MARKS-wise!')
print('7. Search IP MARKS-wise!')
print('8. Search PERCENTAGE-wise!')
print('9. Return to the main menu!')
choice=int(input('Enter choice:'))
if choice==1:
nm=input('Enter Student Name to search:')
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['NAME']==nm]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==2:
id=int(input('Enter Student ID to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['ID']==id]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('-------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==3:
phy=int(input('Enter Physics marks to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['PHYSICS']==phy]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==4:
CHEM=int(input('Enter Chemistry marks to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['CHEMISTRY']==CHEM]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==5:
maths=int(input('Enter Maths marks to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['MATHS']==maths]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==6:
Eng=int(input('Enter English marks to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['ENGLISH']==Eng]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==7:
ip=int(input('Enter IP marks to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['IP']==ip]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
elif choice==8:
per=float(input('Enter PERCENTAGE to search:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
b=df[df['PERCENTAGE']==per]
if b.empty:
print('******************************************************************************')
print(' xxxxxxxxx Record Not Found!! xxxxxxxxxx')
print('******************************************************************************')
else:
print('------------------------------------------------------------------------------')
print(len(b), 'Record(s) found!!')
print('******************************************************************************')
print(b)
print('******************************************************************************')
elif choice==9:
break
elif choice==4:
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
print('*******************CURRENT STATUS OF RESULTS OF THE STUDENTS******************')
print(df)
print('******************************************************************************')
idx=int(input('Enter row index of the record to be deleted:'))
x=int(input('Are you sure to delete the record. Press 1 for YES and 0 for NO:'))
if x==1:
df.drop(idx,inplace=True)
df.to_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv",mode='w',na_rep=' ')
print('******************************************************************************')
print('Record deleted successfully')
print('******************************************************************************')
else:
print('******************************************************************************')
print('Delete Operetion is Cancelled')
print('******************************************************************************')
x=input('Press any key to continue..........................................')
print('\n'*3 )
elif choice==5:
while True:
print('------------------------------------------------------------------------------')
print('Select the criteria for PLOTTING !!!')
print('1. PLOT THE GRAPH PHYSICS MARKS WISE!')
print('2. PLOT THE GRAPH CHEMISTRY MARKS WISE!')
print('3. PLOT THE GRAPH MATHS MARKS WISE!')
print('4. PLOT THE GRAPH ENGLISH MARKS WISE!')
print('5. PLOT THE GRAPH IP MARKS WISE!')
print('6. PLOT THE GRAPH OVERALL PERCENTAGE WISE!')
print('7. Return to the main menu!')
choice=int(input('Enter choice:'))
df=pd.read_csv(r"C:\Users\Alok Verma\Desktop\AK\Code\Book1.csv")
if choice==1:
a=df['PHYSICS'].tolist()
x=df['NAME'].tolist()
plt.bar(x,a,color=['red','yellow','blue','green','grey','violet','orange','indigo','brown'],width=0.5)
plt.xlabel('NAMES OF THE STUDENTS')
plt.ylabel('MARKS')
plt.title('PHYSICS MARKS')
plt.show()
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==2:
a=df['CHEMISTRY'].tolist()
x=df['NAME'].tolist()
plt.bar(x,a,color=['red','yellow','blue','green','grey','violet','orange','indigo','brown'],width=0.5)
plt.xlabel('NAMES OF THE STUDENTS')
plt.ylabel('MARKS')
plt.title('CHEMISTRY MARKS')
plt.show()
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==3:
a=df['MATHS'].tolist()
x=df['NAME'].tolist()
plt.bar(x,a,color=['red','yellow','blue','green','grey','violet','orange','indigo','brown'],width=0.5)
plt.xlabel('NAMES OF THE STUDENTS')
plt.ylabel('MARKS')
plt.title('MATHS MARKS')
plt.show()
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==4:
a=df['ENGLISH'].tolist()
x=df['NAME'].tolist()
plt.bar(x,a,color=['red','yellow','blue','green','grey','violet','orange','indigo','brown'],width=0.5)
plt.xlabel('NAMES OF THE STUDENTS')
plt.ylabel('MARKS')
plt.title('ENGLISH MARKS')
plt.show()
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==5:
a=df['IP'].tolist()
x=df['NAME'].tolist()
plt.bar(x,a,color=['red','yellow','blue','green','grey','violet','orange','indigo','brown'],width=0.5)
plt.xlabel('NAMES OF THE STUDENTS')
plt.ylabel('MARKS')
plt.title('IP MARKS')
plt.show()
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
elif choice==6:
a=df['PERCENTAGE'].tolist()
x=df['NAME'].tolist()
plt.bar(x,a,color=['red','yellow','blue','green','grey','violet','orange','indigo','brown'],width=0.5)
plt.xlabel('NAMES OF THE STUDENTS')
plt.ylabel('PERCENTAGE')
plt.title('OVERALL PERCENTAGE')
plt.show()
print('******************************************************************************')
x=input('Press any key to continue........')
print('\n'*3 )
break
elif choice==6:
print('Thank You!!!!')
break
#Note : Change the path of the csv file