Skip to main content

Section 4.12 Evaluation Conditionals-WE5-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.12.1

Use this given setup for each of the questions below.
alpha = 2
beta = 1
delta = 3
eta = 0
gamma = 0

Exercises Exercises

1.
Q14: After executing the following code, the value in variable gamma is , the value in variable eta is , and the value in the variable beta is .
if alpha > delta:
    gamma = alpha - 2
    if gamma == eta:
        eta = beta
        beta += 1
    eta = beta + 2
2.
Q15: After executing the following code, the value in variable gamma is and the value in variable eta is .
if alpha > beta:
    if delta > eta:
        eta = alpha + 2
    gamma = alpha + 5
    if gamma == eta:
        eta = beta + 2
You have attempted 1 of 4 activities on this page.