Python program to check if a number is Positive or Negative

In today’s tutorial, we are going to share a Python program to check if a number is Positive or Negative. If you are a python beginner and want to start learning the python programming, then keep your close attention in this tutorial as I am going to share a Python program to check if a number is Positive or Negative.

Ses the below number series from which we will check if a number is positive, negative or zero.

1

2

3

-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10

Python program to check if a number is Positive or Negative with the output

Copy the below python program and execute it with the help of python compiler. At the end of this tutorial, We have shared the output of below program.

Program:

1

2

3

4

5

6

7

8

9

num=float(input("Enter a number: "))

ifnum>0:

print("{0} is a positive number".format(num))

elifnum==0:

print("{0} is zero".format(num))

else:

print("{0} is negative number".format(num))

Output:

#first try Enter a number: -8 -8.0 is negative number #second try Enter a number: 9 9.0 is a positive number #third try Enter a number: 0.0 is zero

Subscribe my updates via Email

We use cookies to ensure that we give you the best experience and deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.OkPrivacy policy