Site icon T4Tutorials.com

Positive, Negative Number in Python

Write a Program in Python to check if a Number is Positive, Negative, or Zero

# We are using the Default function to use if else condition  
def NumberCheck(a):   
    # This will check that the number is positive  or negative
    if a > 0:   
        print("The entered Number is Positive")   
    # Checking if the number is negative   
    elif a < 0:   
        print("The entered Number is Negative")   
    # Else the number is zero  
    else:   
        print("The entered Number is zero")  
# Taking number from user  
a = float(input("Please Enter a number: "))  
# Printing result  
NumberCheck(a)

Output

Please Enter a number: 7
The entered Number is Positive

0 is a positive or negative number

Exit mobile version