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

In this example, we will learn how to check whether a number is positive, negative or zero. We will be using the if elif else and input statement to check the value.

1# Get user input to check the value 2number = float(input("Enter a number: ")) 3if number > 0: 4 print("Positive number") 5elif number < 0: 6 print("Negative number") 7else: 8 print("Zero")


1Enter a number: 10 2Positive number 3 4Enter a number: -5 5Negative number