-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
41 lines (37 loc) · 1021 Bytes
/
test.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
#!/usr/bin/python
import sys
res = []
n = 0
with open('res.txt') as file:
data = file.read()
lines = data.split('\n')
for id, line in enumerate(lines):
if(id>0):
cols = line.split('\t')
if(cols[0] == ''):
continue
cols[1] = cols[1].replace('\r', '')
res.append(float(cols[1]))
n += 1
correct = 0
student = []
student_results = []
with open("out.txt") as file:
data = file.read()
lines = data.split('\n')
for id, line in enumerate(lines):
cols = line.split('\t')
if(cols[0] == ''):
continue
if(id==0):
student = cols
elif(id>1):
cols[1] = cols[1].replace('\r', '')
student_results.append(float(cols[1]))
diff = 0
for index, res_col in enumerate(res):
diff += abs(res_col - student_results[index])
percentage = 100 - abs(diff/sum(res))*100
print student
print 'Procenat tacnosti:\t'+str(percentage)
print 'Ukupno:\t'+str(n)