# Arup Guha
# 11/9/2020
# Solution to COP 2930 Program 9 Part A

def countElectoralVotes(votesA,votesB,electoralVotes):

    # Set up our accumulator.
    electoralVotesA = 0

    # Go through each state.
    for i in range(len(votesA)):

        # Add in the votes for this state only if candidate A won it.
        if votesA[i] > votesB[i]:
            electoralVotesA += electoralVotes[i]

    # This is what we want to return.
    return electoralVotesA

# Has my hard-coded tests.
def testfunction():

    # Test given, should be 47.
    votesA = [100, 50, 80, 99, 210]
    votesB = [85, 51, 79, 3, 211]
    electoralVotes = [10, 2, 20, 17, 3]
    print("Test 1 output is", countElectoralVotes(votesA, votesB, electoralVotes))

    # Should be 7 and 0, respectively.
    print("Test 2 output is", countElectoralVotes([90], [89], [7]))
    print("Test 3 output is", countElectoralVotes([90], [90], [7]))

    # Should be 0.
    print("Test 4 output is", countElectoralVotes([1,2,3,4,5,6,7,8],[2,3,4,5,6,7,8,9],[100,200,300,400,500,600,700,800]))

    # Should be 3600.
    print("Test 5 output is", countElectoralVotes([2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8],[100,200,300,400,500,600,700,800]))

    # Current counts (11/9/2020 2 pm) for GA, PA, NV, AZ, AK and NC.
    print("Test 6 output is", countElectoralVotes([2466633,3362388,670344,1644074,64246,2658322],[2455987,3317091,634158,1626943,118844,2733707],[16,20,6,11,3,15]))

    # Reorder states, do GA, AK, NV, PA, NC and AZ.
    print("Test 7 output is", countElectoralVotes([2466633,64246,670344,3362388,2658322,1644074], [2455987,118844,634158,3317091,2733707,1626943],[16,3,6,20,15,11]))
    
# Run it.
testfunction()

        
