Task: Write an algorithm for making a peanut butter sandwich. Every step must be precise enough that a robot — who knows nothing about sandwiches — could follow it exactly. A robot cannot "assume" anything.
Example of an imprecise step: "Put peanut butter on the bread." (Which bread? How much? With what? Which side?)
Example of a precise step: "Using a butter knife, scoop 2 tablespoons of peanut butter from the jar. Spread it on one side of one slice of bread, covering the entire surface."
Total number of steps written: _______
Exchange with a partner: read their algorithm exactly as written. Did it produce a correct sandwich? What step was missing or imprecise? _______________________________________________
Find the bug(s) in this algorithm. There is at least one step that is wrong, missing, or in the wrong order:
Bug(s) found: _______________________________________________
Corrected algorithm (rewrite it with the bug fixed):
A loop repeats steps a set number of times. Write a loop algorithm for watering 5 plants:
How many total steps does the computer execute if it repeats 3 steps 5 times? _______ steps
Why is a loop more efficient than writing out all 15 steps separately? _______________________________________________
A conditional runs different steps depending on whether a condition is true. Complete the flowchart and the code:
Scenario: A school checks whether a scholar has completed their homework before allowing free reading time.
Computational thinking starts by breaking a large problem into smaller, solvable parts. Break down the problem "Plan a community potluck dinner for 20 families" into 4 sub-problems. Each sub-problem should be specific enough to solve:
Sub-problem 1: _______________________________________________
Sub-problem 2: _______________________________________________
Sub-problem 3: _______________________________________________
Sub-problem 4: _______________________________________________
Dorothy Vaughan managed a group of Black women mathematicians at NACA (later NASA) in the 1950s. When she learned that electronic computers would replace human computers, she taught herself FORTRAN and trained her entire team so they would not lose their jobs. She wrote algorithms that were used in the first American orbital spaceflight. Name one decision she made that was algorithmic thinking — that is, one decision where she identified a problem, planned a sequence of steps, and executed them in order. Explain the connection between her story and what you practiced today:
A function lets you write code once and use it many times. Read this function and answer the questions:
What does result1 equal? _______ result2? _______ result3? _______
What are the parameters of this function? _______________________________________________
Write a new function called calculate_annual_savings that takes weekly_savings as a parameter and returns the annual total (multiply by 52):
A list stores multiple values under one name. Access each item by its index number, starting at 0.
scholars[2] = _______ scholars[4] = _______ How many items in this list? _______
Write a loop that prints every name in the list:
How many times does the loop body execute? _______
Pattern recognition: all of these problems share the same structure. Identify the pattern and write ONE function that solves all of them.
Problem set: "A co-op has 6 members. Each contributes $40. Total = ?"
"A class has 18 scholars. Each brings 2 books. Total books = ?"
"A family buys 4 bags of rice. Each bag has 10 pounds. Total pounds = ?"
The pattern in all three: _______________________________________________
Verify: call your function with the three problem sets above and confirm each answer:
Function call 1: _______________ = _______ Check: _______
Function call 2: _______________ = _______ Check: _______
Function call 3: _______________ = _______ Check: _______
A grading program gives letter grades based on score. Complete the nested conditional:
assign_grade(93) returns: _______ assign_grade(74) returns: _______ assign_grade(58) returns: _______
Algorithmic bias is documented: when algorithms are trained on biased data, they produce biased results. A 2016 ProPublica investigation (documented, publicly available) found that a criminal justice algorithm called COMPAS rated Black defendants as "high risk" of reoffending at nearly twice the rate as white defendants with identical records. Name one specific way that the algorithms you wrote today could become biased if the input data were skewed. What responsibility does a programmer have to check for bias in their own code?
Two approaches to find the largest number in a list of n numbers:
If the list has 1,000,000 numbers, how many comparisons does Approach A make in the worst case? _______
How many does Approach B make? _______ What is the tradeoff — what does Approach B require that Approach A does not? _______________________________________________
In what real-world situation would Approach A be better despite being slower? _______________________________________________
The following dataset represents test scores for 10 scholars: [88, 72, 95, 61, 84, 90, 77, 88, 69, 83]
Write pseudocode or calculations to answer each question:
Mean (average): Sum = _______ Count = _______ Mean = _______
Median: Sort the list first: _______________________________________
The two middle values are _______ and _______. Median = _______
Mode: Which score appears most often? _______ How many times? _______
Range: Max = _______ Min = _______ Range = _______
Write a function that takes a list and returns all three: mean, median, and mode:
Design (not build) a simple community library management system. Before writing any code, a software engineer writes specifications. Complete the specification document:
| Specification Element | Your Design |
|---|---|
| What data does the system store? (list at least 4 data types) | |
| What can a user DO in this system? (list at least 5 actions) | |
| What data structure would you use to store books, and why? | |
| What happens when a book is checked out? (describe the state change) | |
| What is one edge case — an unusual situation the system must handle? | |
| What is one security concern and how would you address it? |
Read this scenario: A city government uses a predictive policing algorithm that analyzes historical crime data to direct police patrols to certain neighborhoods. The algorithm was trained on 20 years of arrest data.
Identify the data input: _______________________________________________
What bias might already exist in the training data? _______________________________________________
What is the feedback loop — how might the algorithm's outputs affect future data, creating a self-reinforcing cycle? _______________________________________________
Who is harmed if the algorithm is biased? Who is benefited? _______________________________________________
As the programmer, what documented steps could you take before deploying this algorithm? _______________________________________________
Mark Dean holds three of IBM's original nine PC patents and led the team that created the first gigahertz chip processor. He was awarded the status of IBM Fellow — the highest honor at IBM. Philip Emeagwali designed an algorithm in 1989 that used 65,000 processors working in parallel to perform 3.1 billion calculations per second — a world record that contributed to the development of the modern internet. Research one of these two engineers using documented sources. Write a paragraph: what specific algorithmic or systems design problem did they solve, what made their approach innovative, and what connection does their documented work have to the computational thinking skills you practiced today?