Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+6 votes
asked in old_CSC201 by (1 point)

1 Answer

+1 vote

When the number of repblication, democratic, and other votes are split after reading the line from the file they are strings. You must use the int function to convert the string to an integer to be able to compare them correctly to assign 'red' or 'blue'. You must also do this is the makePurpleDict funciton before you do the arithmetic with them to create the shade of purple.

Something like this:

    republicanNum = int(lineData[1])
    democratNum = int(lineData[2]) 
answered by (1 point)
...