-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask2.py
68 lines (57 loc) · 1.8 KB
/
task2.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import json
current = 0
maxLength = 0
maxName = ""
counts = {}
with open('RomeoAndJuliet.json') as f:
data = json.load(f)
for acts in data['acts']:
for scenes in acts['scenes']:
for actions in scenes['action']:
if actions['character'] not in counts:
counts[actions['character']] = 0
current = 0
for phrase in actions['says']:
current += len(phrase)
if current > maxLength:
maxLength = current
maxName = actions['character']
counts[actions['character']] += 1
print(counts)
print("maximum replics: ", max(counts, key=counts.get))
print("the longest speech: ", maxName, maxLength)
config = {
'cpp': {
'g++': {
'compile': '$\\MinGW32-gcc-8.1.0\\bin\\g++ % -Wl,--stack=536870912 -o solution.exe -w -static-libgcc -static-libstdc++',
'run': 'solution.exe',
'id' : 5
},
'cl': {
'compile': '$\\vcc2015\\bin\\cl /Ox /I$\\vcc2015\\include /I$\\vcc2015\\ucrt\\x86 /EHsc /Fe: solution.exe % /link/LIBPATH:$\\vcc2015\\lib /STACK:536870912',
'run': 'solution.exe',
'id': 0
}
},
'python': {
'python-2': {
'compile': None,
'run': '$\\python2.7\\python.exe %',
'id' : 1
},
'python-3': {
'compile': None,
'run': '$\\python3.6\\python.exe %',
'id' : 2
},
},
'java': {
'java-1.8-x64': {
'compile': '$\\jdk1.8.0_121\\bin\\javac.exe Task.java',
'run': '$\\jdk1.8.0_121\\bin\\java.exe -Xmx512m -Xss32m -Xms8m -Duser.language=en_US Task',
'id': 3
},
},
}
with open('config.json', 'w') as outfile:
json.dump(config, outfile)