A Program to Check a Number is Positive or Negative
In this example, we are giving a program to check a number given by user is positive, negative or zero.
Program to check a number is positive, negative or zero:
# Check a number is positive, negative or zero
num = float(input('Enter a number: '))
if num > 0:
print("Positive number")
elif num == 0:
print("Zero")
else:
print("Negative number")
Output:
Enter a number: 7 Positive number