Skip to content

Instantly share code, notes, and snippets.

@auriza
Last active May 9, 2019 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auriza/5aef1e07157a77143153c49a31191c58 to your computer and use it in GitHub Desktop.
Save auriza/5aef1e07157a77143153c49a31191c58 to your computer and use it in GitHub Desktop.
from turtle import *
def segi(n, s):
for i in range(n):
forward(s)
left(360/n)
def star(s):
for i in range(12):
forward(s)
right(150)
def snow(s):
if s < 3:
return
for i in range(6):
forward(s)
snow(s/3)
back(s)
right(60)
def tree(s):
if s < 3:
return
else:
pensize(s/20)
forward(s)
left(24) # dahan kiri
tree(s/2)
right(48) # dahan kanan
tree(s/2)
left(24) # kembali ke awal
back(s)
speed(0)
penup()
goto(0, -200)
pendown()
left(90)
color('green')
tree(200)
done()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment