Python Program Check Positive Number

By | January 8, 2023

Python Program Check Positive Number – Write a Python program to input a number and check whether the given number is positive, negative or zero. Use Python if-elif-else construct.

Python Program Check Positive Number, negative or zero

Python Program Check Positive, Negative or Zero Number

# Python program to check a number
# for positive, negative or zero

num = int(input('Enter a number: '))
if num > 0:
    print('The number is positive')
elif num < 0:
    print('The number is negative')
else:
    print('The number is zero')

Output

Enter a number: 7
The number is positive


Enter a number: -56
The number is negative


Enter a number: 0
The number is zero

 42 total views,  1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *