Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program is Python. Please answer all, they are part of the same question. 2.2 Spirals 2.2.1 N Sided Polygon Create a function called drawNgon,

The program is Python. Please answer all, they are part of the same question.

image text in transcribed

image text in transcribedimage text in transcribed

2.2 Spirals 2.2.1 N Sided Polygon Create a function called drawNgon, which takes in a turtle and two numbers - numSides and side Length - and uses that turtle to to draw a polygon with numSides sides with each side side Length pixels long. Your function should start like this: def drawNgon(myTurtle, numSides, sideLength): pass This is very similar to the draw shape problem from the previous week. Calling the function like so- drawNgon (bob,6,100) - where bob is the name of the turtle, would result in the following output: Figure 4: The output for drawNgon (bob,6,100) 2.2.2 Super Spiral Create a function that can draw a spiral made of shapes using the following function. This should use the previous function. Feel free to add additional parameters if needed. # draws a spiral of shapes. # this is done by drawing a single polygon, rotating the turtle a bit, # drawing another polygon until the spiral is completed. # numSides defines the shape of the polygons # sideLength defines how big each polygon is # numShapes defines how many polygons make up the spiral def drawNgonSpiral (myTurtle, numSides, sideLength, numShapes): pass Figure 5: drawNgonSpiral (bob,6,100,35) creates a spiral of 35 hexagons. Each hexagon is offset by 20.57 degrees (720 -- 35 20.57). Your output does not need to match my output; this is here to give you a better idea of what to expect. 3.3 Super Duper Spiral Modify drawNgon and drawNgonSpiral or create new functions so that the turtle gradually changes the color of the spiral as it draws the shape, like in Figure 6. Figure 6: The output of drawNgonSpiral(bob,3,100,3) with color

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions