0
Why isn't my code alternating and it always takes the green color?
import turtle t = turtle.Turtle() t.speed(1) t.width(2.5) for bs in range(4): t.color("red") t.forward(80) t.penup() t.forward(20) t.pendown() t.right(90) for nsss in range(4): if nsss%2 == 0: t.color("blue") else: t.color("green") for side in range(4): t.forward(20) t.right(90) t.penup() t.forward(23) t.pendown()
4 odpowiedzi
+ 1
You are not doing any drawing in the loop, you just set the color. So after the loop it is green.
+ 1
Alr .. I figured it out ^_^
0
Take a look again i added the whole code!..I just want it to pick a different color between blue & green each time
0
Lisa then how do i alternate between them and pick a color then draw with it then pick the other color and draw🔁?