Question: Python3 using turtle (1) From polygons to houses (1a) From last weeks project (Week 3 project) use function polygon which will draw an n-sided polygon

Python3 using turtle

(1) From polygons to houses

(1a) From last weeks project (Week 3 project) use function polygon which will draw an n-sided polygon with the sides length and color, using turtle movement commands (e.g., fd, bk, lt, rt, fillcolor, begin_fill(), end_fill(),penup()[or pu()], pendown [or pd()], setpos(), ht(),).

Test your function for examples: >>> polygon(4, 100, 'green')

>>> polygon(3, 75, 'yellow')

(1b) Write a function, house, that draws a square house with a door and a roof. The house body, door, and roof should be drawn by calling function polygon. The house function definition will not have any parameters and will return the value None (end of the function, type return None)..

Test the function, for example:

>>> house()

Python3 using turtle (1) From polygons to houses (1a) From last weeks

week3 code:

def my_polygon(n,length,color): my.color(color)

my.begin_fill() deg=360/ for i in range(0,n): my.fd(length) my.lt(deg) my.end_fill()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!