from turtle import * from random import * dep = -160 c1, c2 = (60,200,230), (30,) *3 rvb = [0,0,0] speed(0) def T(u,a1,a2,b1,b2): return (b2-b1)/(a2-a1)*(u-a1)+b1 while dep < 160: penup() goto(dep,randint(-50,50)) for i in range(3): rvb[i] = T(dep,-160,160,c1[i],c2[i]) pencolor((rvb[0],rvb[1],rvb[2])) setheading(0) pendown() while abs(position()[1]) < 50 and abs(position()[0]) <= 160: setheading(heading() + randint(-2, 2)) fd(3) dep += .5