Program to Check if a Number is Positive Negative or Zero
This Python program checks if the number(entered by user) is positive, negative or zero.
Python code
The user is asked to enter the number, the input number is stored in a variable number and then we have checked the number using if..elif..else statement.
# User enters the number
number = int(input("Enter number: "))
# checking the number
if number < 0: print("The entered number is negative.") elif number > 0:
print("The entered number is positive.")
elif number == 0:
print("Number is zero.")
else:
print("The input is not a number")
Output
Enter number: 4
The entered number is positive
Leave Comment