Referenced from lesson Contracts (Spring, 2021)
1 What kind of triangle does the triangle
function produce?
There are lots of other kinds of triangles! And Pyret has lots of other functions that make triangles!
triangle:: (size:: Number, style :: String, color :: String) -> Image
right-triangle:: (base::Number, height::Number, style::String, color::String) -> Image
isosceles-triangle:: (leg::Number, angle::Number, style::String, color::String) -> Image
2 Why do you think triangle only needs one number, while right-triangle and isosceles-triangle need two numbers and triangle-sas needs three?
3 Write right-triangle expressions for the images below. One argument for each should be 100
.
4 What do you think the numbers in right-triangle represent?
5 Write isosceles-triangle expressions for the images below. 1 argument for each should be 100
.
6 What do you think the numbers in isosceles-triangle represent?
7 Write 2 expressions that would build right-isosceles triangles. Use right-triangle for one expression and isosceles-triangle for the other expression.
|
These materials were developed partly through support of the National Science Foundation,
(awards 1042210, 1535276, 1648684, and 1738598).
Bootstrap:Integrated Oklahoma 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.