I have an if-else statement that I am using to determine the turtle's pen color and line width. When I run my program, it will plot the appropriate points, but only draw them in 'white' with the minimum line width. Within the 'windspeeds' list, there are numerous values that exceed the minimum standard of 74 in my if-else statement. What causes the if-statement to not pass the value into the correct statement?
t.penup()
t.setpos(longitudes[0], latitudes[0])
t.pendown()
i = 0
while i < len(latitudes):
t.setpos(longitudes[i], latitudes[i])
for index in windspeeds:
if index < 74:
t.pencolor("white")
t.width(2)
elif 74 <= index <= 95:
t.pencolor("blue")
t.width(4)
elif 96 <= index <= 110:
t.pencolor("green")
t.width(6)
elif 111 <= index <= 129:
t.pencolor("yellow")
t.width(8)
elif 130 <= index <= 156:
t.pencolor("#FFA500")
t.width(10)
elif 157 <= index:
t.pencolor("red")
t.width(12)
i += 1
Aucun commentaire:
Enregistrer un commentaire