-
Notifications
You must be signed in to change notification settings - Fork 7
/
israel.py
25 lines (21 loc) · 747 Bytes
/
israel.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
import apportionment.methods as app
print("Parties with surplus-vote agreements are treated as coalitions")
print("See https://www.knesset.gov.il/lexicon/eng/seats_eng.htm\n")
with open("knesset.txt", "r") as f:
for line in f:
knesset_nr, partynames, votes, officialresult, threshold = eval(line)
print("Knesset #" + str(knesset_nr) + ":")
result = app.compute(
"dhondt",
votes,
sum(officialresult),
parties=partynames,
threshold=threshold,
verbose=True,
)
# actual results
print(
"Identical with official result: "
+ (str(tuple(result) == tuple(officialresult)))
+ "\n\n"
)