# List of numbers
numbers = [
749216,
719274,
104888,
119964,
172002,
277173
]
# List of Partei labels
parteien = [
"Partei A",
"Partei B",
"Partei C",
"Partei D",
"Partei E",
"Partei F"
]
# 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 119 and rounding the result
first_divisor = round(total_sum / 119)
print(f"First Divisor: {first_divisor}")
# Change the second divisor until number of seats fit (here increase until seats = 119)
second_divisor = 18054
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"Sitze für {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}")