-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathverifyVector.py
42 lines (33 loc) · 898 Bytes
/
verifyVector.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
import sys
#open the file
designatedFile=open("v-data.txt","r")
count=0
line=[]
line1=[]
#Read the first line
line1=designatedFile.readline()
line1=line1[:-2]
line1=line1[1:]
line1=line1.split(',')
#read each line from the file
for line in designatedFile:
#split the line
line=line[:-2]
line=line[1:]
line=line.split(',')
if len(line)==len(line1):
for i in range(0,len(line)):
if line1[i]<>line[i]:
count=count+1
#print count
if int(line[i])-int(line1[i])<>1 or count>1:
print line1
print line
print 'Two Critical Sections Overlapped'
sys.exit()
else:
print 'Vector size are not matching and something went wrong'
sys.exit()
line1=line
count=0
print 'No Critical Section in Overlapped'