Which of the following changes can be made so that the code segment works as intended?
Understand the Problem
The question is asking how to modify a given code segment so that the variable 'score' is correctly adjusted based on the 'penalty'. The problem arises when reducing 'score' by 'penalty' results in a negative value, which should instead set 'score' to 0. It is looking for the correct logical conditions to fix the issue.
Answer
D. Interchanging lines 3 and 7
The final answer is D. Interchanging lines 3 and 7
Answer for screen readers
The final answer is D. Interchanging lines 3 and 7
More Information
Interchanging lines 3 and 7 ensures the 'score' is set to 0 only when it should not be reduced by the 'penalty', aligning with the desired logic as described.
Tips
A common mistake is misinterpreting the condition logic; ensure to comprehend the logic flow correctly.
AI-generated content may contain errors. Please verify critical information