# Lab 5 - Exercise 2 - Problem (Exploration Exercise) 4 # # Let’s now create a function by encapsulating (this word is defined in Chapter 4 # of our online textbook) the code that draws one square into a function. # Let’s make our function such that it does not take any parameters (yet) and it # does not return anything. Let’s modify the main part of our program such that it # call this function 3 times, i.e., still produces the black squares illustrated above. # # Anne Lavergne # March 2017 import turtle as t def square( ): for each in range(4): t.forward(50) t.right(90) return # MAIN part of program - Top Level t.setup(width=600, height=500) t.pencolor('black') t.penup() t.goto(-75,40) t.pendown() # Square 1 square( ) t.penup() t.forward(90) t.pendown() # Square 2 square( ) t.penup() t.forward(90) t.pendown() # Square 3 square( )