Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Copy of U4L09 Activity Guide

Name(s)Taliah, Rohan, Alexander Period ______ Date ___________________ 

  Activity Guide - Functions Explore/Investigate 

View the ​song lyrics​ and answer the following prompts.


● In Style 1, what line of the song do you sing after line 09? What about in Style 2? 
 
In Style 1 you continue singing the song in Style 2 it says chorus instead of the words 
of the chorus. 
 
● Style 2 uses fewer lines to write. Are there fewer lyrics to sing? 
 
No still the same amount  
 
● What are the benefits of writing a song in Style 2? 
 
Compression  
 
 
Navigate to ​Level 2​ in code studio and add code to make it sing the chorus. 
 
Navigate to ​Level 4​ in code studio and answer the following prompts: 
 
On what line(s) is the ​updateScreen​ functions being declared?

10, 11, 17, 18

On what lines is the ​updateScreen​ function being called?

6, 12, 19

How does the ​updateScreen​ function make the program easier to write and understand?

It shows the user the updated screen after the input.

1
Copy of U4L09 Activity Guide

Then,

● Change the program to make the game end when the score is ​15​ or greater.
● Change the program to make the game end when the score is ​-10​ or less.
● Change the program to make it display the word ​" clicks"​ after the count as you play the
game. For example, it should say ​"5 clicks"​ or ​"10 clicks"​ instead of just ​5​ or ​10.

Navigate to ​Level 5​ in code studio and do the following: 


● Look inside the event handler for the ​"lemon"​ and ​"lime"​ to find the repeated code.
● Replace the repeated blocks of code with a single function called ​updateScreen()​ that you
declare once but call twice.

Then, answer the following prompt:

● How does the newly added ​ updateScreen​ function help keep your code better organized
or reduce the amount of repeated code?

It will repeat the function for you.

 
 

You might also like