# Q. Write a python program to print one of  the words negative ,zero or positive. ￼

Q. Write a python program to print one of  the words negative ,zero or positive. according to whether variable x is less than 0, 0 or greater than 0 respectively.

Program -1: Write a python program to check if number is positive,negative or zero

```#Python program to check entered number is zero ,positive or negative
x = float(input("Enter any number: "))
if x > 0:
print("%.1f is Positive number." %x)
elif x == 0:
print("you have entered Zero!")
else:
print("%.2f is Negative number." %x)

```

## output

```First run
Enter any number: 0
you have entered Zero!

Second run
Enter any number: 12
12.0 is Positive number.

Third run
Enter any number: -6
-6.00 is Negative number.
```

## Program-2

```#Python program to check entered number is zero ,positive or negative
x = float(input("Enter any number: "))
if x >= 0:
if x == 0:
print("you have entered Zero!")
else:
print("{0} is Positive number." .format(x))
else:
print("{0} is Negative number." .format(x))

```

## output

```>>> %Run 'zero nmber.py'
Enter any number: 34
34.0 is Positive number.

>>> %Run 'zero nmber.py'
Enter any number: -21
-21.0 is Negative number.

>>> %Run 'zero nmber.py'
Enter any number: 0
you have entered Zero!
```

## Program3:

```#Python program to check entered number is zero ,positive or negative
x = float(input("Enter any number: "))
y=["positive number" if x>0 else "negative number" if x<0 else "zero" ]
print(y)

```

## output

```>>> %Run zero3.py
Enter any number: 12
['positive number']

>>> %Run zero3.py
Enter any number: -9
['negative number']

>>> %Run zero3.py
Enter any number: 0
['zero']
```
<