Embercode
✕
ConditionalsQuick quiz

Decision tables

6 questions. Covers Decision tables in Python.

Questions 1 to 5 of 6

  1. 1. Match each word from the lesson with its meaning.

    Choose the matching item for each row.

  2. 2. The cinema table has a Student card column and a Weekend column. Match each cell to the Python condition the lesson gives for it.

    Choose the matching item for each row.

  3. 3. Put these steps in the order the lesson gives for turning rules written as sentences into a decision table and then into code.

    Use the arrows to put the steps in order.

    1. 1.Write one if with a return for each row, in table order
    2. 2.Run every combination of the conditions and count the combinations that no row covers
    3. 3.Ask the person who wrote the rules about any case the sentences leave out
    4. 4.Turn each sentence into one row of the table, in the same order as the sentences
  4. 4. Put these steps in the order Python follows to find the outcome for one combination of conditions when the table is written as if statements.

    Use the arrows to put the steps in order.

    1. 1.If that row matches, its return value is the answer and no lower row is checked
    2. 2.If the row does not match, Python moves down to the next row and checks it the same way
    3. 3.If no row matches, the final raise runs
    4. 4.Python checks the first row, from top to bottom
  5. 5. A shipping table has three rows: over 50 gives 0 for any customer, not over 50 with a member gives 2, and not over 50 with a non-member gives 5. Why must the over-50 row be first?

3 question(s) left on this page.