A value that matches no branch
Predict the output · Medium · §6.6 [Pair coding with AI] Asking for branching code
You asked an AI for code that groups survey responses by satisfaction score (1 to 5 points), and this is the code you got. However, the satisfaction score of people who did not respond is stored as 0. Predict the output without running the code.
Code
rating = 0
if rating >= 4:
group = "satisfied"
elif rating >= 2:
group = "neutral"
elif rating >= 1:
group = "dissatisfied"
print("Response score:", rating)
print("Group:", group)Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.