Answer these questions:
- (POGIL) Suppose you had a list of positive numbers such as 5, 10, 12, 13, 6, 7, 1, 3, 2, 1. And suppose for each of the numbers in the list you added the number to a running total if it is even and subtracted it if it is odd. What result would you get for this list of numbers?
- Answer
- 0 (these portfolio questions were different than those on the CSP site for some reason)
- (POGIL) Write a pseudocode algorithm that implements the algorithm you used to calculate this total.
- Answer
- For each number in the list:
- if even, add number to running total
- if odd, subtract number from running total
- In this lesson you learned about pseudocode. Write an algorithm in pseudocode for washing a stack of 5 cups and saucers, where the rule is that cups are washed in hot water and saucers in cold water. Use indentation to make your algorithm easy to read and identify those parts of your algorithm that are examples of Sequence, Selection, and Repetition.
- Answer
- Sort saucers from cups.
- Turn on cold water.
- Pick up saucer.
- Apply soap to saucer.
- Wash saucer.
- Repeat 5 times.
- Turn off cold water.
- Turn on hot water.
- Pick up cup.
- Apply soap to cup.
- Wash cup.
- Repeat 5 times.
- Turn off hot water.