# Second votes
numbers = [
10400000,
12200000,
4700000,
4000000,
6400000,
1300000,
1000001
]
# List of Partei labels
parteien = [
"Partei A",
"Partei B",
"Partei C",
"Partei D",
"Partei F",
"Partei G",
"Partei J"
]
# Create a dictionary to map each Partei to its corresponding number
parteien_dict = {parteien[i]: numbers[i] for i in range(len(parteien))}
# Print the Partei and corresponding number
for partei, number in parteien_dict.items():
print(f"{partei}: {number}")
# Calculate the sum of the numbers
total_sum = sum(numbers)
print(f"\nTotal Sum: {total_sum}")
# Calculate first_divisor by dividing the sum by 630 and rounding the result
first_divisor = round(total_sum / 630)
print(f"First Divisor: {first_divisor}")
# Change the second divisor until number of seats fit (decrease or increase until seats = 630)
second_divisor = 63550
print(f"Second Divisor: {second_divisor}")
# Calculate the number of seats for each Partei using first_divisor
seats_for_parteien_first = {partei: round(number / first_divisor) for partei, number in parteien_dict.items()}
# Calculate the number of seats for each Partei using second_divisor
seats_for_parteien_second = {partei: round(number / second_divisor) for partei, number in parteien_dict.items()}
# Print the seats for each Partei using first_divisor
print("\nSeats using First Divisor:")
for partei, seats in seats_for_parteien_first.items():
print(f"Sitze für {partei}: {seats}")
# Calculate the total number of seats using first_divisor
total_seats_first = sum(seats_for_parteien_first.values())
print(f"\nTotal using First Divisor: {total_seats_first}")
# Print the seats for each Partei using second_divisor
print("\nSeats using Second Divisor:")
for partei, seats in seats_for_parteien_second.items():
print(f"Seat for {partei}: {seats}")
# Calculate the total number of seats using second_divisor
total_seats_second = sum(seats_for_parteien_second.values())
print(f"\nTotal using second Divisor: {total_seats_second}")