-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
37 lines (34 loc) · 896 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
#!/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[cols[0]] = cols
n += 1
correct = 0
student = []
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', '')
if (res[cols[0]] == cols):
correct += 1
print student
print 'Tacnih:\t'+str(correct)
print 'Ukupno:\t'+str(n)
print 'Uspeh:\t'+str(100*correct/n)+'%'