Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+4 votes

I've put the code to make the colors in the two functions at the top of the program, the code from step 10 of the directions that is supposed to get the color from the function, and used setFill to add color to the polygon, but it draws solid black. Why?

asked in old_CSC201 by (8 points)

1 Answer

0 votes

The likely reason is that the subregion name in the main method has a \n and the subregion name in the dictionary that is associated with the color does not.

The Boolean slides have the likely fix on slide 3.

for count in range(numRegions):
        subregion = fin.readline() # read the sub-region name
        # subregion name will have a \n 
	    # slice off the \n which is one character
        subregion = subregion[:-1]

This is the "outer loop" in your program. Your code may not be identical because you have different variable names, but the idea is the same.

answered by (8 points)
...