turtlesdayoff.py

Created by ews31415

Created on December 14, 2021

1.24 KB

The Python’s Turtle does on a sunny, rest day.


# 2021-12-14 ews
from math import *
from turtle import *

# ground
penup()
goto(-160,0)
pensize(3)
color('green')
setheading(0)
pendown()
forward(320)
right(90)
forward(1)
right(90)
forward(320)
left(90)
color(128,64,0)
forward(1)
left(90)
forward(320)
right(90)
forward(1)
right(90)
forward(320)

# center
def cen():
  penup()
  goto(0,0)
  setheading(90)
  pendown()

# leaves
pensize(2)
color(0,64,0)
cen()    
for i in range(80):
  forward(1)
  left(1)
cen()    
for i in range(80):
  forward(1)
  right(1)

cen()
color(0,128,0)    
for i in range(27):
  forward(3)
  left(1)
cen()    
for i in range(27):
  forward(3)
  right(1)

cen()    
color(0,255,0)
for i in range(16):
  forward(5)
  left(1)
cen()    
for i in range(16):
  forward(5)
  right(1)
  
# flowers
penup()
goto(-113,0)
setheading(90)
color('green')
pendown()
forward(32)
right(90)
color('red')
circle(16)

penup()
goto(-96,0)
setheading(90)
color('green')
pendown()
forward(52)
right(90)
color('red')
circle(19)

penup()
goto(80,0)
setheading(90)
color('green')
pendown()
forward(52)
right(90)
color('red')
circle(20)

penup()
goto(100,0)
setheading(90)
color('green')
pendown()
forward(36)
right(90)
color('red')
circle(15)

# rest the turtle :)
penup()
goto(1,1)
setheading(0)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.