Skip to content

Instantly share code, notes, and snippets.

@JayantGoel001
Created February 11, 2021 15:48
Show Gist options
  • Save JayantGoel001/bb9b6c225347c6f21b2693fd00c4390a to your computer and use it in GitHub Desktop.
Save JayantGoel001/bb9b6c225347c6f21b2693fd00c4390a to your computer and use it in GitHub Desktop.
Creating A Rainbow Design using turtle
import turtle as t
t.speed(5)
t.bgcolor('black')
r, g, b = 255, 0, 0
for i in range(255 * 2):
t.colormode(255)
if i < 255 // 3:
g += 3
elif i < 255 * 2 // 3:
r -= 3
elif i < 255:
b += 3
elif i < 255 * 4 // 3:
g -= 3
elif i < 255 * 5 // 3:
r += 3
else:
b -= 3
t.forward(50 + i)
t.right(91)
t.pencolor(r, g, b)
t.hideturtle()
t.done()
@JayantGoel001
Copy link
Author

Rainbow Design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment