golden_treble.py

Created by nick-koberstein

Created on August 13, 2021

618 Bytes


from math import *
from turtle import *

penup()
goto(20,-45)
pendown()
A =[10,10]
for k in range(4):
 x = A[k] + A[k+1]
 A.append(x)
for i in A:
 for j in range(5):
   backward(i)
   right(90)
 backward(i)
  
penup()
goto(50,85)
pendown()
for i in A[:4]:
 for j in range(5):
   forward(i)
   left(270)
 forward(i)
  
penup()
goto(10,-95)
left(90)
pendown()
for i in A[:3]:
 for j in range(5):
   forward(i)
   left(270)
 forward(i) 

penup()
goto(20,-45)
pendown()
pensize(2)
left(180)
for i in A:
  circle(-i,90)
  left(180)
for i in [30,20]:
  circle(i,90)
goto(10,-95)
left(90)
circle(-10,180)