Skip to content

Instantly share code, notes, and snippets.

@edib
Last active September 24, 2016 22:23
Show Gist options
  • Save edib/7dc60f2a0692ecefc79e70bcf1eabc59 to your computer and use it in GitHub Desktop.
Save edib/7dc60f2a0692ecefc79e70bcf1eabc59 to your computer and use it in GitHub Desktop.
rotate number given as command line argument
import turtle
import random
import sys
def r():
return random.randint(0, 255)
screen = turtle.Screen()
screen.bgcolor("#fff")
screen.colormode(255)
tosba = turtle.Turtle()
tosba.color("#f00")
tosba.pensize(5)
tosba.speed(0)
tosba.hideturtle()
loop = int(sys.argv[1])
for i in range(loop):
tosba.color(r(),r(),r())
for i in range(4):
tosba.rt(90)
tosba.fd(100)
tosba.rt(360/loop)
tosba.hideturtle()
turtle.getscreen()._root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment