Answer:
Step-by-step explanation:
The following program asks the user to enter the precinct number and then loops to add votes until no more votes need to be added. Then it breaks the loop and creates a file called results to save all of the results for that precinct.
precinct = input("Enter Precinct Number: ")
option1 = 0
option2 = 0
while True:
choice = input("Enter your vote 1 or 2: ")
if int(choice) == 1:
option1 += 1
else:
option2 += 1
endVote = input("Vote again y/n")
if endVote.lower() != 'y':
break
f = open("results.txt", "w")
f.write("Precinct " + precinct + ": \\Option 1: " + str(option1) + "\\Option 2: " + str(option2))