python 的一个绘图代码
1 import turtle 2 import time 3 turtle.pensize(2) 4 turtle.bgcolor("black") 5 colors=["red","yellow","purple","blue"] 6 for x in range(400): 7 turtle.forward(2*x) 8 turtle.color(colors[x%4]) 9 turtle.left(91)
效果图如下
1 import turtle 2 import time 3 turtle.pensize(2) 4 turtle.bgcolor("black") 5 colors=["red","yellow","purple","blue"] 6 for x in range(400): 7 turtle.forward(2*x) 8 turtle.color(colors[x%4]) 9 turtle.left(91)
效果图如下