You are on page 1of 3

CSP U4L6 Conditionals Investigate Activity Guide

Directions: Go to Code Studio ​Unit 4 Lesson 6​. Follow the instructions listed below at each
level. Make sure you watch the videos throughout this lesson as they will be your guide to a
better understanding of conditionals. .

Level 2
Watch the video in Code Studio before moving on to Level 3. You can also watch it by clicking
on this ​link

Level 3
Complete the following prompts for ONE assigned section of code. Then, you will share with
another group. When they explain, add explanations for their sections.

Section 1: lines 1 - 13
● Explain what the section does:
Activates the play button
● Call out any lines of code you thought were interesting or confusing:
The math that goes into setting the score
Section 2: lines 16 - 30
● Explain what the section does:
If your mouse touches the lemon you get a point
● Call out any lines of code you thought were interesting or confusing:
I thought the way that the mouse touched it was cool at to the code
Section 3: lines 33 - 53
● Explain what the section does:
If the mouse touches the lime you go down one point and lose one life
● Call out any lines of code you thought were interesting or confusing:
The way it controlled both losing a life and losing a point
● Modify: ​Right now the game keeps going when the player has 0 lives. ​Fix this problem​.

● What did you do to the code to fix this problem?


I added more lives

Level 4
Watch the video in Code Studio before moving on to Level 5. You can also watch it by clicking
on this ​link

Level 5
Watch the video in Code Studio before moving on to Level 6. You can also watch it by clicking
on this ​link

Level 6
Investigate the code for this new version of the Lemon Squeeze App.
● What's changed since last time in how the game works?
● Find the if-else-if statement that was added to the program.
● “Draw” a flowchart for the if-else-if statement in the box below (double-click on it to open
up a canvas where you can insert shapes, arrows and add text)

● Modify t​ he program so that the lemon becomes even smaller when the user has more
than 15 points. See the gif in this Level’s instructions for how to expand an `if-else-if'
block

Level 7
Watch the video in Code Studio before moving on to Level 8. You can also watch it by clicking
on this ​link

Level 8
Investigate the code for this new version of the Lemon Squeeze App.
● What's changed since last time in how the game works?

● Find the if-else-if statement that was added


● Draw a flowchart for the if-else-if statement in the box below (double-click on it to open
up a canvas where you can insert shapes, arrows and add text)
● Modify t​ he app to add one more username and password.
○ You'll need to edit both the code and user interface.
○ Warning​: ​Use a fake password. It's never a good idea to use real passwords
directly in your code like this

Level 9
Read the pattern introduced in Level 9.
Notice how the first condition is the most specific. This pattern appears frequently with if-else-if
statements.
● What is the difference between an if-statement, an if-else statement, and an if-else-if
statement?
○ If and else if both are used to test the conditions. In the if case compiler 
check all cases Wether it is true or false. if no one block execute then else 
part will be executed. in the case of else if compiler stop the flow of 
program when it got false value.

● How are they similar?


They both Have a part in making the program work

You might also like