Python program that checks if a given number is positive, negative, or zero:
number = float(input("Enter a number: "))
if number > 0:
print("The number is positive")
elif number < 0:
print("The number is negative")
else:
print("The number is zero")
The program prompts the user to enter a number using the input() function, and stores the value in the variable “number”. It then uses an if-elif-else statement to check the value of the number. If the number is greater than 0, it is positive. If the number is less than 0, it is negative. Otherwise, it is zero.
Another way to check if a number is positive, negative or zero is by using comparison operators:
number = float(input("Enter a number: "))
if number > 0:
print("The number is positive")
if number < 0:
print("The number is negative")
if number == 0:
print("The number is zero")
Both the methods will give you the same output which is whether the number is positive, negative or zero. You can use any method that suits your need or preference.