SmartStart_Curriculum_3.1_en
Smart Start Curriculum. Area 3: Algorithmic thinking 71 / 76 Exercise 3: Find and Fix the Bug Topic: Testing, debugging, and iterative improvement Objective: To practice using systematic testing to identify and correct errors in an algorithm or simple program. Format: Individual or pair problem-solving activity. Instructions: A teacher wants a program to classify students' test results: • 80 or above: “Excellent” • 50–79: “Passed” • Below 50: “Try again” The following program does not always produce the intended result: score = int(input("Enter score: ")) if score >= 50: print("Passed") elif score >= 80: print("Excellent") else: print("Try again") Do not immediately rewrite the code. First: 1. Predict the output for scores of 40, 50, 79, 80, and 95 . 2. Run or simulate the program. 3. Identify which outputs are incorrect. 4. Explain why the error occurs. 5. Modify the algorithm so that all five inputs produce the intended result. 6. Test the revised solution. Then explain why testing only one input would not have been sufficient to identify the problem. Deliverable: A debugging record containing: Prediction → Test → Error identified → Explanation → Correction → Retest and the corrected version of the algorithm.
Made with FlippingBook
RkJQdWJsaXNoZXIy MjQzMTQ4