Python Program to Check if a Number is Positive, Negative or 0

In this post, we will see how to check if number is positive, negative or 0.
It is very easy to check if number is positive, negative or 0.

num=10 #uncomment below line to take input from user #num = float(input("Enter a number: ")) if num > 0: print(num,"is positive number") elif num == 0: print(num,"is Zero") else: print(num,"is negative number")

Output:

10 is positive number

You just need to check if the number is greater than 0 or less than 0 or is equal to 0.

Leave a Reply

Your email address will not be published. Required fields are marked *