Question Detail
Question
What is the output of the following Python code snippet, based on the 'Multi-way Logic: Weather' example?
Correct Answer
Option B is the correct answer.
Detailed Explanation
Page 13, 'Multi-way Logic: Weather':
temp = 32. The first condition if temp > 30 (32 > 30) is True, so 'Hot Day' would be printed. Wait, I made a mistake here. The image shows temp = 32 and if temp > 30: print('Hot Day'). Ah, the code on the slide says temp = 32. So if temp is 32, then temp > 30 is True, and it should print 'Hot Day'. Let me correct my thinking process.
Hint
Carefully trace the value of 'temp' through each condition in the
if-elif-else structure.