You are on page 1of 2

Unit 7 Lesson 2 Activity Guide - Parameters and Return Investigate

Navigate to Level 1 on Code Studio: Follow the instructions, and answer the prompts below

1. How does calculate() work? Calculate takes values from inputs and puts them into equations to give a
value.

2. What are the arguments passed through the parameter in calculate() when it is called? The argument
passed through is +, -, * and it replaces symbol.

3. What types of data does the parameter require in the calculate() function? Where can you find that
information? The parameter requires +, -, *. These symbols can be found in the onEvent and the
Boolean Values in the function

4. What is returned? What type of data? The answer is returned. The answer is a number.

Do This:
● Look at lines 30-36. Look at how the MOD operator % works. Watch the video walk-through about MOD.

Modify: Make the following changes to the code

● Add a divide button.


● In addition to displaying if the number is even or odd, display if the number is divisible by 3.

Level 2 - Follow the instructions, and answer the prompts below

1. Lines 1 - 14: Read the code carefully. What is happening here? The code is creating global
variables, grabbing data, creating a list, calling a function, and the code has on events for
buttons that call the function.
2. Read the function on lines 15-34 carefully. After you are done, explain how the function works,
what parameters it takes and what is returned. The function shows the image and creates a list
for words that are filtered. The output is then cleared, and the function runs a loop to separate
the words. If the word fits the criteria it is added to the list that is filtered. The image then
dissapears and the words are seen in the output.

3. How does the Word Game Helper work? The word game helper works based on the number of
letters and what letter is selected. Once this is given, the code shows the user what words fit
their criteria.

Challenge (optional)?

● Remove the letter dropbox and replace it with an input box. Update the code so the user
can type any number of letters, and only words that start with those letters and are the
specified length will be displayed.

You might also like