Type each expression (left) below into the code.pyret.org (CPO) and match it to the image it creates (right).

Expression Image

triangle-sas​(​120, 45, 70, "solid", "black"​)

1

A

solid black right scalene triangle

triangle-sas​(​120, 90, 70, "solid", "black"​)

2

B

solid black obtuse scalene triangle. short leg on top. mid-length leg angling out toward the lower right

triangle-sas​(​120, 135, 70, "solid", "black"​)

3

C

solid black obtuse scalene triangle. mid-length leg on top. short leg angling out toward the lower right

triangle-sas​(​70, 135, 120, "solid", "black"​)

4

D

solid black obtuse scalene triagle. legs and hypotenuse are closer in length than the other triangles. shortes leg on top. mid-size leg angling off to the lower left

Contracts

Think about how you would describe each triangle-sas argument to someone who’d never used the function before.

5 Annotate the Contract below using descriptive variable names.

triangle-sas :: ( Number, Number, Number, String, String ) -> Image

If you have a printed workbook, add examples of each of the triangle functions we’ve explored to your contracts pages.

If you have time, experiment with the triangle-asa function.

# triangle-asa :: (Numbertop-left-angle, Numberleft-side, Numberbottom-angle, Stringfill-style, Stringcolor) -> Image

Why did these two functions need to take in one more Number than right-triangle did?

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.