Skip to content

Instantly share code, notes, and snippets.

@brentxphillips
Created February 12, 2021 02:25
Show Gist options
  • Save brentxphillips/7307bace438dfc7a5575fc10b5bc600e to your computer and use it in GitHub Desktop.
Save brentxphillips/7307bace438dfc7a5575fc10b5bc600e to your computer and use it in GitHub Desktop.
Draws a square using range function
# Brent Phillips
# Drawes square using range
import turtle as t
def goto(x, y):
t.up()
t.goto(x, y)
t.down()
def rangebox(move, turn, color="black", fill=False, scale=1):
t.color(color)
if fill:
t.begin_fill()
x = range(4)
for n in x:
t.forward(move*scale)
t.right(turn)
if fill:
t.end_fill()
goto(0, 0)
rangebox(100, 90, "blue", True, 2)
t.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment