apportionment/examples/austria.py

18 wiersze
480 B
Python
Czysty Zwykły widok Historia

2020-01-31 14:16:37 +00:00
import apportionment.methods as app
with open("./nr_wahlen.txt", "r") as f:
for line in f:
2020-01-09 10:58:23 +00:00
year, partynames, votes, officialresult = eval(line)
print(year)
result = app.compute(
"dhondt", votes, 183, parties=partynames, threshold=0.04, verbose=True
)
# actual results
print(
"Identical with official result: "
+ (str(tuple(result) == tuple(officialresult)))
+ "\n\n"
)