pull/3/head
benjaminkrenn 2020-01-09 12:38:02 +01:00
rodzic a461253a78
commit b70224dc1d
3 zmienionych plików z 20 dodań i 18 usunięć

Wyświetl plik

@ -43,7 +43,7 @@ D'Hondt (Jefferson) method
which is indeed the [official result](https://www.bmi.gv.at/412/Europawahlen/Europawahl_2019).
Another example can be found in [examples/example.py](examples/example.py).
An example with the Austrian National Council elections can be found in [examples/austria_example.py](examples/austria_example.py)
An example with the Austrian National Council elections can be found in [examples/austria_examples.py](examples/austria_examples.py)
## References

Wyświetl plik

@ -1,17 +0,0 @@
from __future__ import print_function
import sys
sys.path.insert(0, '..')
import apportionment
with open("./nr_wahlen.txt", "r") as f:
for line in f:
result = eval(line)
print(result[0])
print(apportionment.method("dhondt", result[2],
sum(result[3]),
parties=result[1],
threshold=.04,
verbose=False))
# actual results
print(result[3])

Wyświetl plik

@ -0,0 +1,19 @@
from __future__ import print_function
import sys
sys.path.insert(0, '..')
import apportionment
with open("./nr_wahlen.txt", "r") as f:
for line in f:
year, partynames, votes, officialresult = eval(line)
print(year)
result = apportionment.method("dhondt", votes,
183,
parties=partynames,
threshold=.04,
verbose=True)
# actual results
print("Identical with official result: "
+ (str(tuple(result) == tuple(officialresult)))
+ "\n\n")