23. Python Program to Check if a number is Positive or Negative.
How does this program work?
- In this program you are going to learn about to check if a number is positive or negative using Python.
- This problem is solved using if and nested if...else statement.
- A number is positive if it is greater than zero. We check this in the expression of if.
- If it is False, the number will negative.
Here is the code
a = int(input ("Enter a number: "))
if a < 0:
print("Number is Negative")
else:
print("Number is Positive")