To check for positive, negative, or zero in python, you have to ask from user to enter a number to check whether that number is a positive number, negative number, or zero as shown in the program given here.
Following python program ask from user to enter any number to check for positive number, negative number or zero:
# Python Program - Check Positive Negative and Zero while True: print("Enter 'x' for exit.") num = input("Enter any number: ") if num == 'x': break try: number = int(num) except ValueError: print("Please, enter a number...") else: if number < 0: print("It is a negative number.\n") elif number == 0: print("It is a zero.\n") elif number > 0: print("It is a positive number.\n") else: print(number, "is strange.\n")
Here is the sample run of the above Python program: