Last active
May 9, 2019 07:37
-
-
Save auriza/5aef1e07157a77143153c49a31191c58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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