Python Programming - Conditional Statements - Discussion

Discussion Forum : Conditional Statements - General Questions (Q.No. 21)
21.
What will be the output of the following code?
number = 15
result = "Even" if number % 2 == 0 else "Odd"
print(result)
Even
Odd
Error
No output
Answer: Option
Explanation:
The code uses a conditional expression (if-else shorthand) to determine if number is even or odd. In this case, it is odd, so the result is "Odd."
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.