-
Notifications
You must be signed in to change notification settings - Fork 242
Quality Control
Sar Champagne Bielert edited this page Apr 8, 2024
·
4 revisions
Unit 2 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through each product, and add it to a new dictionary with "pass" or "fail" depending on its score.
1) Categorized products dict start empty
2) For each product, check score
a) If below threshold, add product to categorized and map to "fail"
b) Otherwise, add product to categorized and map to "pass"
3) Return the categorized products
def quality_control(product_scores, threshold):
categorized_products = {} # Initialize an empty dictionary
for product_id in product_scores
if product_scores[product_id] >= threshold:
categorized_products[product_id] = "pass"
else:
categorized_products[product_id] = "fail"
return categorized_products