Week 8
Conditional Execution
Weekly Summary
How do you write programs when you need to do different things in different situations? The answer is, you use conditionals.
Recall from our prior Scratch Unit that we defined conditionals as:
This week we will begin to consider programs that use conditional statements to modify how code behaves.
Learning Outcomes
By the end of the week students should be able to:
- Reading Code
- Given a Boolean expression using one of the six Boolean operators (<, <=, >, >=, == or !=), indicate the evaluated output (True or False).
- Given a compound Boolean expression (one that includes one or more of AND, OR, or NOT, indicate the evaluated output (True or False).
- Explain the difference in Python between = and ==.
- Given a small script (including data with values) containing an if statement, indicate the output of the script.
- Given a small script containing an if/else statement, indicate the output of the script.
- Given a small script containing an if/else statement with one or more elif statements, indicate the output of the script.
- Writing Code
- Given an IPO problem statement that includes conditionals (if, if/else and if/elif/else statements), write the python code that will solve the problem.
- Debugging Code
- Given a problem statement and a non-working program that attempts to solve the problem, identify where the code is incorrect and explain how to fix it.