-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmarks_numpy_example.py
More file actions
46 lines (34 loc) · 1.27 KB
/
marks_numpy_example.py
File metadata and controls
46 lines (34 loc) · 1.27 KB
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
'''Given data has 12 columns.
Sid, sname, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10 (m = marks)
m1,m2,m3 --> are group1 subjects which has the minimum pass mark 35
m4,m5,m6 --> are group2 subjects which has the minimum pass mark 50
m7,m8,m9,m10 --> are group3 subjects which has the minimum pass mark 60
Student must pass atleast 2 subjects In each group and overall in all 7 subjects in combination of 3 groups
Find how many students passed and failed. '''
import numpy as np
file = open("F:/eda_dataset/python_numpy_transformations.txt")
header = file.readline()
#print(header)
data = file.readlines()
sname = []
for i in data:
w = i.split(',')
sname = [w[1]]
print(sname)
m1,m2,m3,m4,m5,m6,m7,m8,m9,m10 = int(w[2]), int(w[3]), int(w[4]), int(w[5]), int(w[6]), int(w[7]), int(w[8]),int(w[9]), int(w[10]),int(w[11])
r1 = 1 if m1>=35 else 0
r2 = 1 if m2>=35 else 0
r3 = 1 if m3>=35 else 0
r4 = 1 if m4>=50 else 0
r5 = 1 if m5>=50 else 0
r6 = 1 if m6>=50 else 0
r7 = 1 if m7>=60 else 0
r8 = 1 if m8>=60 else 0
r9 = 1 if m9>=60 else 0
r10= 1 if m10>=60 else 0
g1 = r1+r2+r3
g2 = r4+r5+r6
g3 = r7+r8+r9+r10
if (g1>=2 and g2>=2 and g3>=2 and g1+g2+g3>=7):
print ("Pass")
else: print("Fail")