Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer must be in Python 3 Answer: import turtle def equiTri(t, size): for side in range(3): t.forward(size) t.left(120) def bumps(t, num, init, delta): for triangles

image text in transcribed

Answer must be in Python 3

Answer:

import turtle

def equiTri(t, size): for side in range(3): t.forward(size) t.left(120)

def bumps(t, num, init, delta): for triangles in range(num): equiTri(t,init) t.forward(init) init += delta s = turtle.Screen() t = turtle.Turtle() t.left(15) bumps(t, 3, 40, 20)

Question lla (8 points) Write a function named equiTri) that uses turtle graphics to draw an equilateral triangle of specified side length. The function equiTri() takes two parameters i. t, a turtle that is used for drawing ii. size, the length of a side of the triangle The function equiTri() should draw a triangle beginning at the initial position and orientation of t, and should leave t with the same position and orientation on exit. Do not make any assumptions about the initial state of the turtle. For full credit you must use a loop for repeated operations. Question 11b (12 points) Write a function named bumps() that uses turtle graphics and the function equiTri) to draw a series of equilateral triangles (bumps) of increasing size. The triangles have a common baseline and each triangle touches the following triangle at a single point. Begin drawing at the initial location of the turtle The function bumps() should repeatedly call equiTri) to draw the triangles. The function bumps() takes 4 parameters i. t, a turtle used for drawing ii. num, the number of triangles to draw iii. init, the length of a side of the first triangle iv. delta, the increase in side length of successive triangles For example if bumps) is called by the following code, the drawing below would be correct output. import turtle s - turtle.Screen() t-turtle.Turtle) t.left (15) bumps (t, 3, 40, 20)

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