Python Programming - Conditional Statements - Discussion
Discussion Forum : Conditional Statements - General Questions (Q.No. 5)
5.
What will happen if the following code is executed?
temperature = 25
if temperature > 30:
print("It's hot!")
elif temperature > 20:
print("It's warm.")
else:
print("It's cool.")
Answer: Option
Explanation:
The code checks multiple conditions using
if
and elif
. Since temperature
is 25, it satisfies the second condition (temperature > 20
), and the corresponding code block inside the elif
will be executed, printing "It's warm."
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers