Referenced from lesson If-Expressions (Spring, 2021)
1 Open the Mood Generator Starter File, and read throught the code you find there. This code contains new programming that you haven’t seen yet! Take a moment to list everything you Notice, and then everything you Wonder…
2 Add another line of code to the definition, so that
mood("mad") produces the same emoji as
3 Add another example to the
examples: section for "laughing", using the appropriate emoji. (To bring up the emojis on your computer, type
Cmd-Ctrl-Space on a Mac, or
Windows-Period on Windows 10)
4 Come up with some new moods, and add them to the code. Make sure you include
5 In your own words, how do if-expressions work in Pyret? Write your answer below.
6 Write down at least 2 ways you could use if-expressions when analyzing the Animals Dataset.
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). Bootstrap:Data Science 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.