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])