# This is the solution file for Lab 5, Exercise 2, Problem 8 # The purpose is to create a nested square and a nested circle # Author: Mengliu Zhao # Date: July 18, 2017 import turtle as t import time def square_up_left(colour, side): t.pencolor(colour) for each in range(4): t.forward(side) t.left(90) return def nested_squared(): square_up_left('black', 200) square_up_left('black', 120) square_up_left('black', 75) def nested_circle(): t.color("black", "green") t.begin_fill() t.circle(100, steps=1000) t.end_fill() t.color("black", "red") t.begin_fill() t.circle(50, steps=500) t.end_fill() t.color("black", "yellow") t.begin_fill() t.circle(20, steps=200) t.end_fill() # main t.setup(width=600, height=800) t.pensize(3) nested_circle() time.sleep(2) t.resetscreen() t.reset() t.setup(width=600, height=800) t.pensize(3) nested_squared() t.exitonclick()