-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpa.py
198 lines (187 loc) · 6.71 KB
/
gpa.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
'''
SGPA CALCULATOR
Author : Nishith P Shetty
Ver 1.0
Run : Win : py gpa.py
Linux : python3 gpa.py
'''
def grade_point(m, c):
if m >= 90:
return (c * 10)
elif m >= 80:
return (c * 9)
elif m >= 70:
return (c * 8)
elif m >= 60:
return (c * 7)
elif m >= 45:
return (c * 6)
elif m >= 40:
return (c * 4)
else :
return (c * 0)
def sgpa1():
subjects = ["21MAT11", "21CHE12", "21PSP13", "21ELN14", "21EME15", "21CHEL16", "21CPL17", "21EGH18", "21SFH19"]
credits = [3, 3, 3, 3, 3, 1, 1, 2, 1]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa2():
subjects = ["21MAT21", "21PHY22", "21ELE3", "21CIV4", "21EVN25", "21PHYL26", "21ELEL27", "21EGH28", "21IDT29"]
credits = [3, 3, 3, 3, 3, 1, 1, 2, 1]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa3():
subjects = ["21MAT31", "21CS32", "21CS33", "21CS34", "21CSL35", "21UH36", "21KSK37/21CIP37", "21CS38X/21CSL38X"]
credits = [3, 4, 4, 3, 1, 1, 1, 1]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa4():
subjects = ["21MAT41", "21CS42", "21CS43", "21CS44", "21BE45", "21CSL46", "21KSK47/21CIP47", "21CS48X/21CSL48X", "21INT49"]
credits = [3, 4, 4, 3, 2, 1, 1, 1, 1, 2]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa5():
subjects = ["21CS51", "21CS52", "21CS53", "21AI54", "21CSL55", "21XX56", "21CIV57", "21CS58X/21CSL58X"]
credits = [3, 4, 3, 3, 1, 2, 1, 1]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa6():
subjects = ["21CS61", "21AD62", "21AI63", "21XX64X", "21XX65X", "21AIL66", "21AIMP67", "21INT68"]
credits = [3, 4, 3, 3, 3, 1, 2, 3]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa7():
subjects = ["21AI71", "21CS72", "21XX73X", "21XX74X", "21XX75X", "21AIP76"]
credits = [3, 2, 3, 3, 3, 10]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
def sgpa8():
subjects = ["21AI81", "21INT82", "21NS83/21PE83/21YO83"]
credits = [1, 15, 0]
marks = []
obtained_credits = credits
points = 0
print("Enter the Total Obtained Marks for the following subjects : ")
for s in subjects:
marks.append(int(input(s + " : ")))
if (input("All Passed ? (Y/N) : ") == "N"):
print("Enter F if failed, else press enter")
for s in subjects:
if (input("s : ") == "F"):
obtained_credits[subjects.index(s)] = 0
for x in range(len(subjects)):
points += grade_point(marks[x], obtained_credits[x])
sgpa = points / sum(obtained_credits)
print("SGPA : ", sgpa)
if __name__ == "__main__":
sem = int(input("Enter the Semester Number of which SGPA should be calculated : "))
match sem:
case 1 :
sgpa1()
case 2 :
sgpa2()
case 3 :
sgpa3()
case 4 :
sgpa4()
case 5 :
sgpa5()
case 6 :
sgpa6()
case 7 :
sgpa7()
case 8 :
sgpa8()
case default :
print("Wrong Semester Number : ")