Japan
For this section of the page, you will refer to the Flags Starter File.
1 Each language has its own symbol for commenting code so that programmers can leave notes that won’t be read by the computer. In Pyret, we use the hash mark (#
).
What color are comments in Pyret?
2 Type japan-flag
into the Interactions Area. What do you get back?
3 Type japan
into the Interactions Area and compare the image to japan-flag
.
-
How are they alike?
-
How are they different?
4 japan
is composed using dot
and background
. Type each of those variables into the Interactions Area. What do you get back?
-
dot:
-
background:
5 These images are combined using the put-image
function. What is its contract?
6 Fix the japan
code so that it matches the japan-flag
image. What did you need to change?
7 How can you prove that you have placed the dot
in exactly the right location?
The Netherlands
For this section of the page, you will refer to the Flags of Netherlands, France & Mauritius Starter File.
8 What was the programmer thinking when she coded the height of the red stripe as 200 / 3
?
9 The center of the blue stripe is placed at (150
, 200 / 6
). How did the programmer know to use 150 as the x-coordinate?
10 What was the programmer thinking when she coded the y-coordinate as 200 / 6
?
11 Explain the thinking behind coding the red stripe’s y-coordinate as 5 * (200 / 6)
.
12 What advantages are there to representing height, length, or width as fractions (as the coder did here) rather than computing and using the value?
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.