Python Programming - Conditional Statements - Discussion

Discussion Forum : Conditional Statements - General Questions (Q.No. 7)
7.
What will be the output of the following code?
num = 0
if num > 0:
    print("Positive")
elif num < 0:
    print("Negative")
else:
    print("Zero")
Positive
Negative
Zero
No output
Answer: Option
Explanation:
The code checks if num is greater than 0, less than 0, or equal to 0. Since num is 0, the code inside the else block will be executed, printing "Zero."
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.