Skip to content

Instantly share code, notes, and snippets.

@nasturtus
Created May 3, 2017 03:48
Show Gist options
  • Save nasturtus/858bfa81cb98c00f12b6cf8664469922 to your computer and use it in GitHub Desktop.
Save nasturtus/858bfa81cb98c00f12b6cf8664469922 to your computer and use it in GitHub Desktop.
# http://greenteapress.com/thinkpython2/html/thinkpython2005.html
import turtle
def polygon(t, n, length):
angle = 360 / n
for i in range(n):
t.fd(length)
t.lt(angle)
bob = turtle.Turtle()
polygon(t=bob, n=8, length=100) # keyword arguments for greater readibility
turtle.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment