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()
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started