Python Program to check Number is Positive or Negative

Write a Python Program to check Number is Positive or Negative with a practical example.

Python Program to check Number is Positive or Negative

This Python program allows the user to enter any numeric value. Next, this Python program verifies whether that number is positive, negative, or zero using the Elif statement.

# Python Program to check Number is Positive or Negative

number = float(input(" Please Enter any Numeric Value : "))

if(number > 0):
    print("{0} is a Positive Number".format(number))
elif(number < 0):
    print("{0} is a Negative Number".format(number))
else:
    print("You have entered Zero")

The below Python statement asks the user to Enter any number.

number = float(input(" Please Enter any Numeric Value : "))

In the next line, We declared the Else If statement

  • First Condition: If (number > 0), check whether the given number is greater than 0. If it is true, then it is a positive number.
  • Second condition: elif (number < 0) check whether a number is less than 0. If this is true, then the given value is a negative number
  • If both the above conditions fail, then it is 0.

Python positive or negative program output

 Please Enter any Numeric Value : 12
12.0 is a Positive Number

This time, we are using Zero

 Please Enter any Numeric Value : 0
You have entered Zero

Let me enter the negative value

Python Program to check Number is Positive or Negative 2