Question Detail
Question
Considering the 'Multi-way Logic: Weather' example on page 13:
What will be the output?
temp = 32if temp > 30: print('Hot Day')elif temp > 15: print('Nice Day')else: print('Cold Day')What will be the output?
Correct Answer
Option A is the correct answer.
Detailed Explanation
As per page 13,
temp is 32. The first condition temp > 30 (32 > 30) is True. So, print('Hot Day') will execute, and the rest of the elif and else blocks will be skipped.
Hint
Remember that in an `if-elif-else` chain, only the first `True` condition's block is executed.