用Python画一个螺旋彩虹超级简单

用代码画一个螺旋彩虹:

import turtle
q = turtle.Pen()
turtle.bgcolor("black")
sides = 7
colors = ["red","cyan","blue","yellow","orange","green","purple"]
for x in range(360):
    q.pencolor(colors[x%sides])
    q.forward(x*3/sides+x)
    q.left(360/sides+1)
    q.width(x*sides/200)

你可能感兴趣的:(Python)