Type each expression (left) below into the code.pyret.org (CPO) and match it to the image it creates (right).
Expression | Image | |||
---|---|---|---|---|
|
1 |
A |
|
|
|
2 |
B |
|
|
|
3 |
C |
|
|
|
4 |
D |
|
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). 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.