SciGirls Code
Week 6
Agenda
2. Conditionals with Cards (unplugged activity)
3. Paint Pot 4
4. Flipgrid Videos/Quizlet Live
Objectives
By completing this activity girls will
- define circumstances when certain parts of programs should run and when they shouldn't.
- determine whether a conditional is met based on criteria.
- interpret a program and predict the outcome, given a set of inputs.
Review Vocab
Loop-the action of doing something over and over again.
Conditional-statements that only run under certain conditions.
Wrap Up
- If we don’t include loops as part of our algorithm, how many people would get to play?
- What other things do you do during the day under certain conditions?
- If you are supposed to do something when the value of a card is more than 5, and you draw a 5, do you meet that condition?
- When you need to meet several combinations of conditions, we can use something called “nested conditionals.” - What do you think that means? - Can you give an example of where we saw that during the game?
- Do you need to put a conditional statement after “Else”? Why not?
Wednesday Meeting
- Review Vocabulary
- Chorus Coding
- Paint Pot 4 Continued...
Chorus Coding
Objectives
By completing this activity girls will
- understand how to modify procedures to accept parameters.
- be able to describe how procedures and parameters can make programs easier to write.
Vocabulary
Defining a title (like chorus) for a little piece of code that you use over and over again is called creating a procedure. This strategy is helpful to computer scientists for the some of the same reasons that it is helpful to songwriters:
- It saves time not having to write the code over and over again in the program.
- If you make a mistake, you only have to change it one place.
- The program feels less complicated with the repeating pieces defined just once at the top.
Parameters-
Ask the girls to think about songs where the chorus isn't exactly the same every time. Could you still use a chorus? The answer is yes, but you have to have a way to let the singer know what special words to use for each verse. These special words are called parameters.
In programming, parameters are passed as special instructions to procedures like this:
- chorus(parameter1, parameter2)
Wrap Up
- Ask: Is it harder to identify a chorus when some words change? How might you use the same idea of calling a chorus when the chorus is different from verse to verse? These changing words and phrases are called “parameters” and you can pass them into the chorus like this: chorus(cow, moo).