squaresonsquare.py

Created by ews31415

Created on December 14, 2021

574 Bytes

Large black squares with small red squares using Turtle.


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

# square
def square(n):
  pendown()
  for i in range(4):
    forward(n)
    left(90)
  penup()

# drawing
penup() 
forward(30)
left(90)
forward(30)
left(90)
square(60)   
    
color(255,0,0)
forward(15)
right(90)
forward(30)
left(90)
square(30)

left(90)
forward(30)
right(90)
forward(45)
left(90)
forward(15)
right(90)
square(30)

left(90)
forward(45)
left(90)
forward(45)
left(180)
square(30)

left(180)
forward(15)
left(90)
forward(45)
right(90)
forward(30)
right(180)
square(30)

goto(0,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>.