Check if a Number is Positive, Negative or 0 Python

PROGRAM TO CHECK IF A NUMBER IS POSITIVE, NEGATIVE OR 0


num = float(input("Enter a number: "))
if num >= 0:
   if num == 0:
       print("Zero")
   else:
       print("Positive number")
else:
   print("Negative number")

OUTPUT
Enter a number: 2         Positive number 
Enter a number: 0         Zero

Comments

Popular posts from this blog

Solve the Sudoku Python

Solve the Sudoku Java

Find Duplicates Java