Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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()

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1. Let a, b R, a Answered: 1 week ago

Answered: 1 week ago

Question

understand the key issues concerning international assignments

Answered: 1 week ago