-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponses.py
More file actions
30 lines (25 loc) · 747 Bytes
/
responses.py
File metadata and controls
30 lines (25 loc) · 747 Bytes
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
def intelligent_split(sample):
flag = True
start_index = 0
result = []
for index, char in enumerate(sample):
if char == ' ' and flag:
result.append(sample[start_index:index])
start_index = index + 1
if char in '"[]':
flag = not flag
result.append(sample[start_index:])
return result
firstType = secondType = thirdType = others = 0
f = open('input.txt')
for line in f.readlines():
split_line = intelligent_split(line)
others += 1
responce = int(split_line[5])
if responce == 200:
firstType += 1
elif 300 <= responce <= 309:
secondType += 1
else:
thirdType += 1
print(firstType, secondType, thirdType, others, sep='\n')