Complete the code to show the first step in computational thinking: breaking a problem into smaller parts.
def solve_problem(problem): parts = problem[1] # Break problem into parts return parts
Breaking a problem into smaller parts is like splitting a big task into manageable pieces. The .split() method divides a string into parts.
Complete the code to show pattern recognition by checking if two parts are equal.
def check_pattern(part1, part2): if part1 [1] part2: return True else: return False
Pattern recognition involves finding similarities. Using == checks if two parts are the same.
Fix the error in the code that shows abstraction by hiding details in a function.
def calculate_area(radius): area = 3.14 * radius [1] 2 return area
Abstraction hides details. Calculating area uses radius squared, which is radius ** 2 in Python.
Fill both blanks to complete the code that shows algorithm design by looping through steps.
steps = ['Understand', 'Plan', 'Execute', 'Review'] for step [1] steps: print(step [2] '!')
Algorithm design means following steps. The for loop uses in to go through each step. Adding '!' uses + to join strings.
Fill all three blanks to create a dictionary comprehension that models computational thinking steps with conditions.
steps = ['Break', 'Recognize', 'Abstract', 'Design'] result = { [1] : [2] for step in steps if len(step) [3] 6 }
This dictionary comprehension models computational thinking steps. It uses {step.upper()} as keys, step as values, and includes steps with length less than 6 using <.