Skip to main content

Section 4.8 Evaluation Conditionals-WE3-P1

Subgoals for Evaluating Selection Statements.

  1. Diagram which statements go together by indentation
  2. For conditional, determine whether expression is true
    1. If true, follow true branch
    1. If false, follow next elif/else branch or exit conditional if no else branch
  3. Repeat step 2 as necessary

Subsection 4.8.1

Use this given setup
alpha = 2
beta = 1
delta = 3
eta = 0
gamma = 0

Exercises Exercises

1.
Q1: After executing the following code:
if alpha > beta:
    alpha = alpha + 2;
if alpha > delta:
    gamma = alpha + 5;
The value of variable alpha is and the value of variable gamma is .
2.
Q10a: After executing the following code:
if (alpha * beta) > delta:
    gamma = alpha * beta
if eta > (alpha / beta):
    eta = alpha / beta
The value in variable alpha is and the value in variable gamma is .
You have attempted 1 of 4 activities on this page.