Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

11A) PYTHON: A rhombus is a parallelogram with four equal sides. It resembles the diamonds suit in playing cards. Here are the properties of a

11A)

PYTHON:

A rhombus is a parallelogram with four equal sides. It resembles the diamonds suit in

playing cards. Here are the properties of a rhombus:

- opposite sides are parallel - all four sides have the same length - opposite angles are equal - sum of any 2 adjacent angles is 180 degrees (x + y = 180 degrees)

Write a function called rhombus that uses turtle graphics to draw a rhombus. The function rhombus takes three parameters:

1. t, a turtle that is used to draw the rhombus. The turtle t may initially be at any location on the screen and in any orientation and may be either up or down. 2. side, an integer that is the length of a side of the rhombus. 3. acuteAngle, the smaller of the two angles x and y.

The function rhombus should:

1. draw a rhombus, beginning at the initial position and orientation of t 2. leave t in its initial position and orientation when it returns For full credit, you must perform repeated operations using a loop.

For example, the following is an example of correct graphical output:

import turtle snappy = turtle.Turtle() rhombus(snappy, 100, 45)

11B) Write a python function named rhombuses that uses turtle graphics and the function rhombus in question 11A to draw a sequence of rhombuses of specified size, position and orientation.

The function rhombuses takes five parameters:

1. t, a turtle that is used for drawing 2. side 3. acuteAngle 4. count 5. rotation

The function rhombuses should call the function rhombus (in Question 11A) repeatedly so as to draw count rhombuses, each with sides of length side and acute angle acuteAngle. Each rhombus should be oriented rotation degrees clockwise from the preceding rhombus.

If rhombuses is called by the following code, this would be correct output: import turtle snappy = turtle.Turtle() rhombuses(snappy, 60, 45, 5, 72)

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

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions